<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/">

<channel>
	<title>WPBeginner &#187; Themes</title>
	<atom:link href="http://www.wpbeginner.com/category/wp-themes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wpbeginner.com</link>
	<description>Beginner&#039;s Guide for WordPress</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:37:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.wpbeginner.com/?pushpress=hub'/>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to Create a Custom Single Attachments Template in WordPress</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-single-attachments-template-in-wordpress/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-single-attachments-template-in-wordpress/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 13:37:46 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[custom single attachment template in wordpress]]></category>
		<category><![CDATA[single attachments template]]></category>
		<category><![CDATA[wordpress attachements template]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=5212</guid>
		<description><![CDATA[<p>In the process of creating a total gallery display in WordPress powered by Custom Post Types, we have shared the code for how to get all post attachments in WordPress except for Featured Image. We have also showed you how to add additional fields to the WordPress Media uploader. In this article, we will show you how to use the additional fields in the media uploader and display them in a custom single attachments template. Before we start, it is...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-single-attachments-template-in-wordpress/">How to Create a Custom Single Attachments Template in WordPress</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>In the process of creating a total gallery display in WordPress powered by Custom Post Types, we have shared the code for <a href="http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/" title="Get all Post Attachments in WordPress Except for Featured Image">how to get all post attachments in WordPress except for Featured Image</a>. We have also showed you <a href="http://www.wpbeginner.com/wp-tutorials/how-to-add-additional-fields-to-the-wordpress-media-uploader/" title="Additional Fields in the Media Uploader">how to add additional fields to the WordPress Media uploader</a>. In this article, we will show you how to use the additional fields in the media uploader and display them in a custom single attachments template. </p>
<p>Before we start, it is important that you understand how the template hierarchy works for attachments. You can either specify it like <strong>mime_type.php</strong>. <a href="http://en.wikipedia.org/wiki/Internet_media_type" title="Mime Type" target="_blank">Mime type</a> examples (image.php, video.php, application.php etc). For specifying it just for a certain image type, you can say image_gif.php. If the mime_type.php is not found, then it looks for attachment.php, then single-attachment.php, then single.php, then index.php.</p>
<p>It depends on how custom of a project you are working for, you may not need to create image_gif.php. You can simply suffice for image.php or even attachment.php.</p>
<p>All you have to do is open a blank file and copy all of your <em>single.php</em> content in there. You can save it as single-attachment.php or any other mime_type that you want. Then replace the loop code with something like this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
$photographer = get_post_meta($post-&gt;ID, 'be_photographer_name', true);
$photographerurl = get_post_meta($post-&gt;ID, 'be_photographer_url', true);
?&gt;

&lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;

&lt;div class=&quot;photometa&quot;&gt;&lt;span class=&quot;photographername&quot;&gt;&lt;?php echo $photographer; ?&gt;&lt;/span&gt; // &lt;a href=&quot;&lt;?php echo $photographerurl ?&gt;&quot; target=&quot;_blank&quot; class=&quot;photographerurl&quot;&gt;&lt;?php echo $photographerurl ?&gt;&lt;/a&gt;&lt;/div&gt;

                        &lt;div class=&quot;entry-attachment&quot;&gt;
&lt;?php if ( wp_attachment_is_image( $post-&gt;id ) ) : $att_image = wp_get_attachment_image_src( $post-&gt;id, &quot;full&quot;); ?&gt;
                        &lt;p class=&quot;attachment&quot;&gt;&lt;a href=&quot;&lt;?php echo wp_get_attachment_url($post-&gt;id); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot; rel=&quot;attachment&quot;&gt;&lt;img src=&quot;&lt;?php echo $att_image[0];?&gt;&quot; width=&quot;&lt;?php echo $att_image[1];?&gt;&quot; height=&quot;&lt;?php echo $att_image[2];?&gt;&quot;  class=&quot;attachment-medium&quot; alt=&quot;&lt;?php $post-&gt;post_excerpt; ?&gt;&quot; /&gt;&lt;/a&gt;
                        &lt;/p&gt;
&lt;?php else : ?&gt;
                        &lt;a href=&quot;&lt;?php echo wp_get_attachment_url($post-&gt;ID) ?&gt;&quot; title=&quot;&lt;?php echo wp_specialchars( get_the_title($post-&gt;ID), 1 ) ?&gt;&quot; rel=&quot;attachment&quot;&gt;&lt;?php echo basename($post-&gt;guid) ?&gt;&lt;/a&gt;
&lt;?php endif; ?&gt;
                        &lt;/div&gt;

&lt;?php endwhile; ?&gt;

&lt;?php endif; ?&gt;
</pre>
<p>The code above simply displays the Image Title. Below it, it will display Author&#8217;s name and URL which we added as additional fields in our previous article. Then it looks for the image and displays the full size. You can customize it to show any other size if you have <a href="http://www.wpbeginner.com/wp-tutorials/how-to-create-additional-image-sizes-in-wordpress/" title="Additional Image Sizes in WordPress">additional image sizes</a>.</p>
<p><strong>Final Outcome:</strong></p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2012/02/single-attachment-ex.gif" alt="Single Attachment Example" title="Single Attachment Example" width="520" height="300" class="alignnone size-full wp-image-5215" /></p>
<p>Now that we have covered all three main aspects of this gallery that we were going to create, in the next article, we will show you how it looks when all things are pieced together. This way, you can use WordPress&#8217;s built-in mechanism to create a full-featured gallery with albums. No extra plugins required.</p>
<p><strong>Resource:</strong><br />
<a href="http://codex.wordpress.org/Template_Hierarchy#Attachment_display" title="Template Hierarchy WordPress Codex" target="_blank">Template Hierarchy Codex</a></p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-single-attachments-template-in-wordpress/">How to Create a Custom Single Attachments Template in WordPress</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-single-attachments-template-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2012/02/single-attachment-ex-150x150.gif" />
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2012/02/single-attachment-ex.gif" medium="image">
			<media:title type="html">Single Attachment Example</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2012/02/single-attachment-ex-150x150.gif" />
		</media:content>
	</item>
		<item>
		<title>How to Get All Post Attachments in WordPress Except for Featured Image</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 15:59:32 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[get all post attachments in wordpress]]></category>
		<category><![CDATA[how to get all post attachments except for featured image in wordpress]]></category>
		<category><![CDATA[how to get all post attachments in wordpress]]></category>
		<category><![CDATA[how to pull all post attachments in wordpress]]></category>
		<category><![CDATA[how to pull all post attachments in wordpress except for featured image]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=5173</guid>
		<description><![CDATA[<p>Recently while working on a custom project for a client, we had to get all post attachments from a custom post type and display them at one place. Because we were creating a grid display, we had each post&#8217;s featured image serving the purpose of a separator. This is why when getting all post attachments, we needed to exclude the featured image, so it doesn&#8217;t show up twice. In this article, we will show you how to get all post...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/">How to Get All Post Attachments in WordPress Except for Featured Image</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently while working on a custom project for a client, we had to get all post attachments from a custom post type and display them at one place. Because we were creating a grid display, we had each post&#8217;s featured image serving the purpose of a separator. This is why when getting all post attachments, we needed to exclude the featured image, so it doesn&#8217;t show up twice. In this article, we will show you how to get all post attachments in WordPress except for the featured image.</p>
<p>All you have to do is paste the following code inside a loop.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php if ( $post-&gt;post_type == 'data-design' &amp;&amp; $post-&gt;post_status == 'publish' ) {
		$attachments = get_posts( array(
			'post_type' =&gt; 'attachment',
			'posts_per_page' =&gt; -1,
			'post_parent' =&gt; $post-&gt;ID,
			'exclude'     =&gt; get_post_thumbnail_id()
		) );

		if ( $attachments ) {
			foreach ( $attachments as $attachment ) {
				$class = &quot;post-attachment mime-&quot; . sanitize_title( $attachment-&gt;post_mime_type );
				$thumbimg = wp_get_attachment_link( $attachment-&gt;ID, 'thumbnail-size', true );
				echo '&lt;li class=&quot;' . $class . ' data-design-thumbnail&quot;&gt;' . $thumbimg . '&lt;/li&gt;';
			}

		}
	}
?&gt;
</pre>
<p>The code above first checks if the post type is data-design and the post status is published. You may not need the first conditional depending on what you are trying to do. Then we simply run the get_posts query. Everything is pretty self explanatory there. The key that we must highlight is the exclude feature. That line is making sure that featured image does not show up. If you take that line away, then the featured image will show up. After specifying all the parameters, we simply specify what to do when each attachment is pulled. We are pulling attachment type for the class variable. Then the $thumbimg variable is simply using wp_get_attachment_link to pull the image at a specific thumbnail size, and it also hyperlinks the image to the single attachment pages. In the final step, we simply echo it.</p>
<p>We ran this code inside a loop with a separate call for featured image which links to the individual post. Final outcome looked something like this:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2012/01/attachmentgrid.gif" alt="Attachment Grid" title="Attachment Grid" width="520" height="222" class="alignnone size-full wp-image-5174" /></p>
<p>Each featured image served as an album identifying image which you can see. The grey spots were filled with the attachments for the post. We hope that this would help those who are looking to push WordPress beyond a blogging platform.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/">How to Get All Post Attachments in WordPress Except for Featured Image</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-get-all-post-attachments-in-wordpress-except-for-featured-image/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2012/01/attachmentgrid-150x150.gif" />
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2012/01/attachmentgrid.gif" medium="image">
			<media:title type="html">Attachment Grid</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2012/01/attachmentgrid-150x150.gif" />
		</media:content>
	</item>
		<item>
		<title>How to Show Comments on the Homepage of Your WordPress Theme</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 14:45:44 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[display comments on homepage]]></category>
		<category><![CDATA[how to display comments on the homepage of your wordpress site]]></category>
		<category><![CDATA[how to show comments on the homepage of your wordpress site]]></category>
		<category><![CDATA[how to show comments on the homepage of your wordpress theme]]></category>
		<category><![CDATA[show comments on homepage]]></category>
		<category><![CDATA[wordpress comments on homepage]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=4816</guid>
		<description><![CDATA[<p>Recently while working on a very secret project, we found a need to show comments on the homepage of the site. Normally, on single pages you can just call comments_template(); and it should display, but it wasn&#8217;t showing up. All we ended up getting was a blank div container. After doing a quick search online, we were able to find the answer. In this article, we will show you how to show comments on the homepage of your WordPress site....</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/">How to Show Comments on the Homepage of Your WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently while working on a very secret project, we found a need to show comments on the homepage of the site. Normally, on single pages you can just call <em>comments_template();</em> and it should display, but it wasn&#8217;t showing up. All we ended up getting was a blank div container. After doing a quick search online, we were able to find the answer. In this article, we will show you how to show comments on the homepage of your WordPress site.</p>
<p>Inside the loop right before endwhile, simply add the following code:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$withcomments = &quot;1&quot;;
comments_template(); // Get wp-comments.php template ?&gt;</pre>
<p>A single line $withcomments makes all the difference. </p>
<p>Note: this was a very simple one page site we threw up. So the theme elements were style.css, index.php, and comments.php file. We were calling a loop to display a specific page on the index.php file along with other things.</p>
<p>We hope that this would help some of you. Some of you may even have a better way of doing this. If you do, please share it with us in the comments.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/">How to Show Comments on the Homepage of Your WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-show-comments-on-the-homepage-of-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
	</item>
		<item>
		<title>How to use Thumbnails with Previous and Next Post Links in WordPress</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 15:25:28 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[how to use thumbnails in previous next navigation in wordpress]]></category>
		<category><![CDATA[how to use thumbnails to navigate between posts]]></category>
		<category><![CDATA[how to use thumbnails with previous and next post links in wordpress]]></category>
		<category><![CDATA[next post links with thumbnail]]></category>
		<category><![CDATA[post nav links with thumbnails]]></category>
		<category><![CDATA[post thumbnails with post navigation in wordpress]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=4805</guid>
		<description><![CDATA[<p>One of our users asked us on our Facebook page: How to use thumbnails for previous/next post navigation in WordPress. The next_post_link and previous_post_link functions doesn&#8217;t have a simple enough thumbnail parameter which a new developer can simply turn on and off. In this article, we will show you how to use post thumbnails with previous and next post links in WordPress. The final result would look like this: First thing you need to do is open your theme&#8217;s single.php...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/">How to use Thumbnails with Previous and Next Post Links in WordPress</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>One of our users asked us on our <a href="http://www.facebook.com/wpbeginner" title="WPBeginner Facebook" target="_blank" rel="nofollow">Facebook page</a>: How to use thumbnails for previous/next post navigation in WordPress. The next_post_link and previous_post_link functions doesn&#8217;t have a simple enough thumbnail parameter which a new developer can simply turn on and off. In this article, we will show you how to use post thumbnails with previous and next post links in WordPress.</p>
<p>The final result would look like this:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2011/11/thumbnailpostnav.gif" alt="Use Thumbnails with Previous and Next Post links in WordPress" title="Use Thumbnails with Previous and Next Post links in WordPress" width="520" height="104" class="alignnone size-full wp-image-4806" /></p>
<p>First thing you need to do is open your theme&#8217;s <em>single.php</em> file and add the following code inside the loop most likely after the_content() area:</p>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;cooler-nav&quot; class=&quot;navigation&quot;&gt;
&lt;?php $prevPost = get_previous_post(true);
if($prevPost) {?&gt;
&lt;div class=&quot;nav-box previous&quot;&gt;
&lt;?php $prevthumbnail = get_the_post_thumbnail($prevPost-&gt;ID, array(100,100) );?&gt;
&lt;?php previous_post_link('%link',&quot;$prevthumbnail  &lt;p&gt;%title&lt;/p&gt;&quot;, TRUE); ?&gt;
&lt;/div&gt;

&lt;?php } $nextPost = get_next_post(true);
if($nextPost) { ?&gt;
&lt;div class=&quot;nav-box next&quot; style=&quot;float:right;&quot;&gt;
&lt;?php $nextthumbnail = get_the_post_thumbnail($nextPost-&gt;ID, array(100,100) ); } ?&gt;
&lt;?php next_post_link('%link',&quot;$nextthumbnail  &lt;p&gt;%title&lt;/p&gt;&quot;, TRUE); ?&gt;
&lt;/div&gt;
&lt;?php } ?&gt;
&lt;/div&gt;&lt;!--#cooler-nav div --&gt;
</pre>
<p>Next thing you need to do is open your <em>style.css</em> file and add the following styles:</p>
<pre class="brush: css; title: ; notranslate">
#cooler-nav{clear: both; height: 100px; margin: 0 0 70px;}
#cooler-nav .nav-box{background: #e9e9e9; padding: 10px;}
#cooler-nav img{float: left; margin: 0 10px 0 0;}
#cooler-nav p{margin: 0 10px; font-size: 12px; vertical-align: middle;}
#cooler-nav .previous{float: left; vertical-align: middle; width: 250px; height: 100px;}
#cooler-nav .next{float: right; width: 250px;}
</pre>
<p>Feel free to change the styling to match it with your theme. Often our users like to style the code, so it makes it easier for them to tweak it. This is just basic styling which you should be able to customize easily.</p>
<p>If you want to change the thumbnail size, then simply change the array(100,100) to whatever you like.</p>
<p>Source: <a href="http://wordpress.org/support/topic/next-amp-previous-post-titles-with-thumbnails?replies=13#post-1724495" title="itsbarry" target="_blank" rel="nofollow">itsbarry</a></p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/">How to use Thumbnails with Previous and Next Post Links in WordPress</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/11/thumbnailpostnav-150x104.gif" />
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2011/11/thumbnailpostnav.gif" medium="image">
			<media:title type="html">Use Thumbnails with Previous and Next Post links in WordPress</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/11/thumbnailpostnav-150x104.gif" />
		</media:content>
	</item>
		<item>
		<title>How to Add Custom Items to Specific WordPress Menus</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-add-custom-items-to-specific-wordpress-menus/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-add-custom-items-to-specific-wordpress-menus/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 19:23:26 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[add a search bar to wordpress menus]]></category>
		<category><![CDATA[add custom items to specific wordpress menus]]></category>
		<category><![CDATA[how to add a search bar to custom wordpress menu]]></category>
		<category><![CDATA[how to add custom items to specific wordpress menus]]></category>
		<category><![CDATA[how to add log in / out link in wordpress menus]]></category>
		<category><![CDATA[how to add twitter icons in wordpress menu]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=4525</guid>
		<description><![CDATA[<p>WordPress menus are freaking awesome. The drag drop interface makes it really easy for WordPress theme developers and the users alike. In the past we have shown you how to add custom menu in WordPress along with how to style a custom menu. One thing that is limited on the visual interface of menus is that you can only add links (pages, category, or custom links). What if you want to add a custom item to your WordPress menus? Maybe...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-add-custom-items-to-specific-wordpress-menus/">How to Add Custom Items to Specific WordPress Menus</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>WordPress menus are freaking awesome. The drag drop interface makes it really easy for WordPress theme developers and the users alike. In the past we have shown you <a href="http://www.wpbeginner.com/wp-themes/how-to-add-custom-navigation-menus-in-wordpress-3-0-themes/" title="How to Add a Custom Menu in WordPress">how to add custom menu in WordPress</a> along with <a href="http://www.wpbeginner.com/wp-themes/how-to-style-wordpress-navigation-menus/" title="How to style a custom menu in WordPress">how to style a custom menu</a>. One thing that is limited on the visual interface of menus is that you can only add links (pages, category, or custom links). What if you want to add a custom item to your WordPress menus? Maybe you want to add a search bar, or log in/out link, today&#8217;s date, or anything else in a WordPress menu. Just because there is no visual interface, does not mean it is not possible. In this article, we will show you how you can utilize the <em>wp_nav_menu_items</em> hook to add custom items to all or specific WordPress menus.</p>
<p>Note: this tutorial is intended for WordPress theme developers, so it is expected that you know basic html/css and a fair understanding of how WordPress themes work.</p>
<p>Obviously, you need to have custom menu enabled in your themes before you can proceed any further.</p>
<p>Lets start with the basics. We need to add our own filter into <em>wp_nav_menu_items</em> hook. An example would look like this:</p>
<pre class="brush: php; title: ; notranslate">
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
    if (is_single() &amp;&amp; $args-&gt;theme_location == 'primary') {
        $items .= '&lt;li&gt;Show whatever&lt;/li&gt;';
    }
    return $items;
}
</pre>
<p>Now as you can see, you can use the conditional statements along with the argument theme_location. This allows you to target a specific menu location with any condition you want. If you don&#8217;t want the conditional statement, you don&#8217;t have to use it. Just add it to a specific menu location or vice versa.</p>
<p>Now that you have seen a basic example, let us show you some specific examples of how this would work.</p>
<h4>Adding Log in/out links to a Specific WordPress Menu</h4>
<p>If you want to give your users the ability to log in/out, then one place you can add the links is in your custom menu. The snippet below will show log in/out links to your users appropriately on the menu location: primary. You can change the menu location if you want. </p>
<pre class="brush: php; title: ; notranslate">
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
    if (is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary') {
        $items .= '&lt;li&gt;&lt;a href=&quot;'. wp_logout_url() .'&quot;&gt;Log Out&lt;/a&gt;&lt;/li&gt;';
    }
    elseif (!is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary') {
        $items .= '&lt;li&gt;&lt;a href=&quot;'. site_url('wp-login.php') .'&quot;&gt;Log In&lt;/a&gt;&lt;/li&gt;';
    }
    return $items;
}
</pre>
<h4>Adding a Search Bar to a Specific Menu</h4>
<p>Want to add a search bar to a specific menu? Well look no further. You can do so by pasting the following snippet:</p>
<pre class="brush: php; title: ; notranslate">
add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
function add_search_box_to_menu( $items, $args ) {
    if( $args-&gt;theme_location == 'primary' )
        return $items.&quot;&lt;li class='menu-header-search'&gt;&lt;form action='http://example.com/' id='searchform' method='get'&gt;&lt;input type='text' name='s' id='s' placeholder='Search'&gt;&lt;/form&gt;&lt;/li&gt;&quot;;

    return $items;
}</pre>
<h4>Adding Today&#8217;s Date to a Specific WordPress Menu</h4>
<p>The snippet below will add today&#8217;s date to your WordPress menu. You can use our <a href="http://www.wpbeginner.com/wp-tutorials/how-to-display-todays-date-in-wordpress/" title="Todays date in WordPress">Today&#8217;s Date manual</a> to tweak the code if you want.</p>
<pre class="brush: php; title: ; notranslate">
add_filter('wp_nav_menu_items','add_todaysdate_in_menu', 10, 2);
function add_todaysdate_in_menu( $items, $args ) {
    if( $args-&gt;theme_location == 'primary')  {

		$todaysdate = date('l jS F Y');
        $items .=  '&lt;li&gt;' . $todaysdate .  '&lt;/li&gt;';

	}
    return $items;
}
</pre>
<p>We hope this article will allow developers to expand the functionality of their themes.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-add-custom-items-to-specific-wordpress-menus/">How to Add Custom Items to Specific WordPress Menus</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-add-custom-items-to-specific-wordpress-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Default WordPress Generated CSS Cheat Sheet for Beginners</title>
		<link>http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/</link>
		<comments>http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 15:10:57 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[default wordpress generated css]]></category>
		<category><![CDATA[default wordpress generated css cheatsheet]]></category>
		<category><![CDATA[list of default wordpress styles]]></category>
		<category><![CDATA[wordpress cheatsheet]]></category>
		<category><![CDATA[wordpress css]]></category>
		<category><![CDATA[wordpress css cheatsheet]]></category>
		<category><![CDATA[wordpress default classes]]></category>
		<category><![CDATA[wordpress default css classes]]></category>
		<category><![CDATA[wordpress theme css]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=2479</guid>
		<description><![CDATA[<p>Have you ever wondered how you could style different elements of the WordPress theme? Well it varies from theme to theme, but there are certain CSS classes and IDs that are generated by WordPress. If you are someone who is trying to style a theme, or looking to create a theme for public release, then these are some style elements that you might want to consider adding in your theme. The goal of this cheat sheet is to assist beginners...</p><p><a href="http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/">Default WordPress Generated CSS Cheat Sheet for Beginners</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered how you could style different elements of the WordPress theme? Well it varies from theme to theme, but there are certain CSS classes and IDs that are generated by WordPress. If you are someone who is trying to style a theme, or looking to create a theme for public release, then these are some style elements that you might want to consider adding in your theme. </p>
<p>The goal of this cheat sheet is to assist beginners who are looking to get into WordPress theme styling. If you are a beginner who does not want to deal with the codes, then we recommend that you get a theme framework like <a href="http://www.wpbeginner.com/refer/headwaythemes" style="" target="_blank" rel="nofollow" >Headway</a> which does the whole thing for you with drag and drop. For the rest of you, we are going to go through some of the most important default WordPress styles one by one.</p>
<h4>Default Body Class Styles</h4>
<p>One of the great things about WordPress is its customizability. It allows you to target very specific aspects of your site with CSS. One of the ways it does this is by adding custom classes to various elements of your blog. The most important of these is the  &lt;body&gt; tag. Here are some examples of common classes that WordPress might add to this element:</p>
<pre class="brush: css; title: ; notranslate">
.rtl {}
.home {}
.blog {}
.archive {}
.date {}
.search {}
.paged {}
.attachment {}
.error404 {}
.single postid-(id) {}
.attachmentid-(id) {}
.attachment-(mime-type) {}
.author {}
.author-(user_nicename) {}
.category {}
.category-(slug) {}
.tag {}
.tag-(slug) {}
.page-parent {}
.page-child parent-pageid-(id) {}
.page-template page-template-(template file name) {}
.search-results {}
.search-no-results {}
.logged-in {}
.paged-(page number) {}
.single-paged-(page number) {}
.page-paged-(page number) {}
.category-paged-(page number) {}
.tag-paged-(page number) {}
.date-paged-(page number) {}
.author-paged-(page number) {}
.search-paged-(page number) {}
</pre>
<p>If, for example, you would like to style your search results page in a specific way you can use the &#8220;search-results&#8221; class to add your styling. WordPress only adds this class to the body tag when the search results page is active so it doesn&#8217;t affect any other pages. </p>
<h4>Default Post Styles</h4>
<p>Just like with the body element WordPress adds dynamic classes to the post elements as well. Here is a list of some of the most popular ones: </p>
<pre class="brush: css; title: ; notranslate">
.post-id {}
.post {}
.page {}
.attachment {}
.sticky {}
.hentry {}
.category-misc {}
.category-example {}
.tag-news {}
.tag-wordpress {}
.tag-markup {}
</pre>
<p>If you have read our article <a href="http://www.wpbeginner.com/wp-themes/what-whys-and-how-tos-of-post-formats-in-wordpress-3-1/" title="Post Formats in WordPress 3.1">What, Whys, and How to’s of Post Formats in WordPress 3.1</a> then you about post formats and how you can display your posts differently according to the format you choose. Once again, WordPress adds dynamic classes to your post using the post_class () function that will allow you to create your own styles for each format. The post_class () function will add a class in the form of &#8220;.format-foo&#8221; where foo is whatever post format you have chosen ie. gallery, image, etc.</p>
<pre class="brush: css; title: ; notranslate">
.format-image {}
.format-gallery {}
.format-chat {}
.format-link {}
.format-quote {}
.format-status {}
.format-video {}
</pre>
<h4>Default Menu Styles</h4>
<p>In our article called <a href="http://www.wpbeginner.com/wp-themes/how-to-style-wordpress-navigation-menus/" title="How to Style WordPress Navigation Menus">how to style WordPress navigation menus</a> we discuss how you can go about adding your own class to your menu. We are going to assume you have read it and that you gave your nav menu its own class name of &#8220;main-menu&#8221;. </p>
<pre class="brush: css; title: ; notranslate">
#header .main-menu{} // container class
#header .main-menu ul {} // container class first unordered list
#header .main-menu ul ul {} //unordered list within an unordered list
#header .main-menu li {} // each navigation item
#header .main-menu li a {} // each navigation item anchor
#header .main-menu li ul {} // unordered list if there is drop down items
#header .main-menu li li {} // each drop down navigation item
#header .main-menu li li a {} // each drap down navigation item anchor

.current_page_item{} // Class for Current Page
.current-cat{} // Class for Current Category
.current-menu-item{} // Class for any other current Menu Item
.menu-item-type-taxonomy{} // Class for a Category
.menu-item-type-post_type{} // Class for Pages
.menu-item-type-custom{} // Class for any custom item that you added
.menu-item-home{} // Class for the Home Link
</pre>
<p>Notice that whenever you create a menu in WordPress it is automatically wrapped in a div. This div only has a class name if you specify it (we chose &#8220;main-menu&#8221;). From there you are just styling the various list elements.</p>
<h4>Default WISIWYG Editor Styles</h4>
<p>The WISWYG editor is one of the most popular and most used aspects of WordPress. For this reason it is a good idea to have styles ready for anything that the user might add to their blog, like images or blockquotes. The following CSS shows you what classes WordPress automatically adds to these elements:</p>
<pre class="brush: css; title: ; notranslate">
.entry-content img {}
.alignleft, img.alignleft {}
.alignright, img.alignright {}
.aligncenter, img.aligncenter {}
.alignnone, img.alignnone {}

.wp-caption {}
.wp-caption img {}
.wp-caption p.wp-caption-text {}

.wp-smiley {}

blockquote.left {}
blockquote.right {}

.gallery dl {}
.gallery dt {}
.gallery dd {}
.gallery dl a {}
.gallery dl img {}
.gallery-caption {}

.size-full {}
.size-large {}
.size-medium {}
.size-thumbnail {}
</pre>
<p>You can see that there are several class pertaining just to images. If, for example, the user decides to include a left-aligned image then WordPress will add the &#8220;alignleft&#8221; class. </p>
<h4>Default WordPress Widget Styles</h4>
<p>Widgets are another popular aspect of WordPress. As the developer you have control over which widgets are going to be displayed so you will usually know exactly which styles to add. WordPress comes with a handful of default widgets, however, and unless you remove them it is wise to add styling to their classes.</p>
<pre class="brush: css; title: ; notranslate">

.widget {}

#searchform {}
.widget_search {}
.screen-reader-text {}

.widget_meta {}
.widget_meta ul {}
.widget_meta ul li {}
.widget_meta ul li a {}

.widget_links {}
.widget_links ul {}
.widget_links ul li {}
.widget_links ul li a {}

.widget_archive {}
.widget_archive ul {}
.widget_archive ul li {}
.widget_archive ul li a {}
.widget_archive select {}
.widget_archive option {}

.widget_pages {}
.widget_pages ul {}
.widget_pages ul li {}
.widget_pages ul li a {}

.widget_links {}
.widget_links li:after {}
.widget_links li:before {}
.widget_tag_cloud {}
.widget_tag_cloud a {}
.widget_tag_cloud a:after {}
.widget_tag_cloud a:before {}

.widget_calendar {}
#calendar_wrap {}
#calendar_wrap th {}
#calendar_wrap td {}
#wp-calendar tr td {}
#wp-calendar caption {}
#wp-calendar a {}
#wp-calendar #today {}
#wp-calendar #prev {}
#wp-calendar #next {}
#wp-calendar #next a {}
#wp-calendar #prev a {}

.widget_categories {}
.widget_categories ul {}
.widget_categories ul li {}
.widget_categories ul ul.children {}
.widget_categories a {}
.widget_categories select{}
.widget_categories select#cat {}
.widget_categories select.postform {}
.widget_categories option {}
.widget_categories .level-0 {}
.widget_categories .level-1 {}
.widget_categories .level-2 {}
.widget_categories .level-3 {}

.recentcomments {}
#recentcomments {}
#recentcomments li {}
#recentcomments li a {}
.widget_recent_comments {}

.widget_recent_entries {}
.widget_recent_entries ul {}
.widget_recent_entries ul li {}
.widget_recent_entries ul li a {}

.textwidget {}
.widget_text {}
.textwidget p {}
</pre>
<p>When styling widgets you will probably end up using the same styles over and over again. For this reason it is a good idea to combine classes on your style sheet using commas. For example, you could combine .widget_pages ul and .widget_archive ul by doing something like this:</p>
<pre class="brush: css; title: ; notranslate">

.widget_pages ul, .widget_archive ul {}
</pre>
<h4>Default Comment Form Styles</h4>
<p>As ugly as styling comments can get WordPress makes it a lot easier with its default classes. If you are not dealing with threaded comments, however, it is possible to ignore many of them.</p>
<pre class="brush: css; title: ; notranslate">

.commentlist .reply {}
.commentlist .reply a {}

.commentlist .alt {}
.commentlist .odd {}
.commentlist .even {}
.commentlist .thread-alt {}
.commentlist .thread-odd {}
.commentlist .thread-even {}
.commentlist li ul.children .alt {}
.commentlist li ul.children .odd {}
.commentlist li ul.children .even {}

.commentlist .vcard {}
.commentlist .vcard cite.fn {}
.commentlist .vcard span.says {}
.commentlist .vcard img.photo {}
.commentlist .vcard img.avatar {}
.commentlist .vcard cite.fn a.url {}

.commentlist .comment-meta {}
.commentlist .comment-meta a {}
.commentlist .commentmetadata {}
.commentlist .commentmetadata a {}

.commentlist .parent {}
.commentlist .comment {}
.commentlist .children {}
.commentlist .pingback {}
.commentlist .bypostauthor {}
.commentlist .comment-author {}
.commentlist .comment-author-admin {}

.commentlist {}
.commentlist li {}
.commentlist li p {}
.commentlist li ul {}
.commentlist li ul.children li {}
.commentlist li ul.children li.alt {}
.commentlist li ul.children li.byuser {}
.commentlist li ul.children li.comment {}
.commentlist li ul.children li.depth-{id} {}
.commentlist li ul.children li.bypostauthor {}
.commentlist li ul.children li.comment-author-admin {}

#cancel-comment-reply {}
#cancel-comment-reply a {}
</pre>
<p>Since this is only a cheatsheet there are still many other classes and id&#8217;s we may not have covered. If you feel as though something else is important and it belongs on this list please feel free to leave a comment below.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/">Default WordPress Generated CSS Cheat Sheet for Beginners</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
	</item>
		<item>
		<title>How to Create a Grid Display of Post Thumbnails in WordPress Themes</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 14:48:02 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[copyblogger style design]]></category>
		<category><![CDATA[grid display of post thumbnails]]></category>
		<category><![CDATA[grid display of post thumbnails in wordpress]]></category>
		<category><![CDATA[grid loop]]></category>
		<category><![CDATA[grid loop in wordpress]]></category>
		<category><![CDATA[grid loop wordpress]]></category>
		<category><![CDATA[how to create a grid display of post thumbnails in wordpress themes]]></category>
		<category><![CDATA[how to create a grid loop in wordpress]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=3677</guid>
		<description><![CDATA[<p>When creating WordPress site designs, have you ever had the urge to create a grid display of posts? The grid layout works great for media centric sites such as our WordPress gallery or another showcase type site. Theme frameworks like Genesis already has a pre-built Grid Loop system. However, if you are trying to do a grid display in your custom WordPress theme, then we are here to help. In this article, we will show you how to create a...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/">How to Create a Grid Display of Post Thumbnails in WordPress Themes</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>When creating WordPress site designs, have you ever had the urge to create a grid display of posts? The grid layout works great for media centric sites such as our <a href="http://gallery.wpbeginner.com" title="WPBeginner WordPress Gallery">WordPress gallery</a> or another showcase type site. Theme frameworks like <a href="http://www.wpbeginner.com/refer/studiopress-genesis" style="" target="_blank" rel="nofollow" >Genesis</a> already has a pre-built Grid Loop system. However, if you are trying to do a grid display in your custom WordPress theme, then we are here to help. In this article, we will show you how to create a grid loop display of <a href="http://www.wpbeginner.com/wp-themes/how-to-add-post-thumbnails-in-wordpress/" title="How to Add Post Thumbnails in WordPress">post thumbnails</a> in your WordPress theme.</p>
<p>Note: you need to have a fair understanding of CSS and how the WordPress loop work.</p>
<p>Before we begin, lets take a look at what we are trying to accomplish:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2011/09/gridpostdisplay.gif" alt="Grid Post Display" title="Grid Post Display" width="520" height="388" class="alignnone size-full wp-image-3750" /></p>
<p>If you notice, the posts on this page are being displayed in a grid. There is a border on the posts on the left hand side, but not on the right hand side. With a normal post loop, all posts follow the same styling, so you will have a right border on both posts which would look weird. Also notice, the spacing are pretty symmetric. Which is again not possible with the normal loop to do for doing something like this. Now that you can see what we are trying to accomplish, lets take a look on how to accomplish it.</p>
<p>First thing you need to do is make sure that your theme has <a href="http://www.wpbeginner.com/wp-themes/how-to-add-post-thumbnails-in-wordpress/" title="WordPress Post Thumbnails">WordPress post thumbnails</a> turned on. You should also think about how you want to <a href="http://www.wpbeginner.com/wp-tutorials/how-to-create-additional-image-sizes-in-wordpress/" title="Creating Additional Image Sizes in WordPress">resize your WordPress images</a> because you will be needing it.</p>
<p>Once you have got the thumbnails and sizes setup, lets get this thing started. Lets setup our loop queries:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$counter = 1; //start counter

$grids = 2; //Grids per row

global $query_string; //Need this to make pagination work

/*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts*/
query_posts($query_string . '&amp;caller_get_posts=1&amp;posts_per_page=12');

if(have_posts()) :	while(have_posts()) :  the_post();
?&gt;
</pre>
<p>The code above seems pretty straight forward because we have made inline comments. One thing that you probably would need to edit is posts_per_page variable to suit your needs. You can also add other query parameters if you so desire. Now that we got the loop started, lets look at how we want to display the posts inside it.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
//Show the left hand side column
if($counter == 1) :
?&gt;
			&lt;div class=&quot;griditemleft&quot;&gt;
				&lt;div class=&quot;postimage&quot;&gt;
					&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_post_thumbnail('category-thumbnail'); ?&gt;&lt;/a&gt;
				&lt;/div&gt;
                &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
			&lt;/div&gt;
&lt;?php
//Show the right hand side column
elseif($counter == $grids) :
?&gt;
&lt;div class=&quot;griditemright&quot;&gt;
				&lt;div class=&quot;postimage&quot;&gt;
					&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_post_thumbnail('category-thumbnail'); ?&gt;&lt;/a&gt;
				&lt;/div&gt;
                &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
			&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;?php
$counter = 0;
endif;
?&gt;
</pre>
<p>We start the code by checking to see if the counter is 1 which means to show our left grid. We simply go in and start a div with a custom css class &#8220;griditemleft&#8221;. Inside it we added the post thumbnail and the post title. You can add or subtract any loop elements (such as excerpts, dates, author info, comment count etc). Notice: In our thumbnails, we are calling an <a href="http://www.wpbeginner.com/wp-tutorials/how-to-create-additional-image-sizes-in-wordpress/" title="Additional Image Sizes in WordPress">additional image size</a>. You will probably have to replace the size-name with your own size that you created.</p>
<p>After the first grid, we added an elseif that looks to see if the $counter matches the number specified in our $grids (which it should because we will be on the second post). If the counter matches, then we can show our right grid which starts with a custom css class &#8220;griditemright&#8221;. Notice after we close the griditemright div, we are adding a clear class. This we will explain when we get to the CSS part.</p>
<p>After the loop is done with this, we reset the counter to 0, so it can start again in the next row.</p>
<p>We can simply end the loop that we started by adding this code:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$counter++;
endwhile;
//Post Navigation code goes here
endif;
?&gt;
</pre>
<p>The code above basically is continuing the counter until it hits the limit that is specified in our query_post variable. The reason why we didn&#8217;t add the post navigation code above is because many folks use a plugin or different display method for this. So we are leaving it open for you to decide for yourself.</p>
<p>So our final loop code will look like this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$counter = 1; //start counter

$grids = 2; //Grids per row

global $query_string; //Need this to make pagination work

/*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */
query_posts($query_string . '&amp;caller_get_posts=1&amp;posts_per_page=12');

if(have_posts()) :	while(have_posts()) :  the_post();
?&gt;
&lt;?php
//Show the left hand side column
if($counter == 1) :
?&gt;
			&lt;div class=&quot;griditemleft&quot;&gt;
				&lt;div class=&quot;postimage&quot;&gt;
					&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_post_thumbnail('category-thumbnail'); ?&gt;&lt;/a&gt;
				&lt;/div&gt;
                &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
			&lt;/div&gt;
&lt;?php
//Show the right hand side column
elseif($counter == $grids) :
?&gt;
&lt;div class=&quot;griditemright&quot;&gt;
				&lt;div class=&quot;postimage&quot;&gt;
					&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_post_thumbnail('category-thumbnail'); ?&gt;&lt;/a&gt;
				&lt;/div&gt;
                &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
			&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;?php
$counter = 0;
endif;
?&gt;
&lt;?php
$counter++;
endwhile;
//Pagination can go here if you want it.
endif;
?&gt;
</pre>
<p>Now that we have the PHP code ready, lets look at how we are going to style it. </p>
<p>Our default output would look like this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;gridcontainer&quot;&gt;
&lt;div class=&quot;griditemleft&quot;&gt;
&lt;div class=&quot;postimage&quot;&gt;	Post Image&lt;/div&gt;
&lt;h2&gt;Post Title&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;griditemright&quot;&gt;
&lt;div class=&quot;postimage&quot;&gt;	Post Image&lt;/div&gt;
&lt;h2&gt;Post Title&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Here are the classes that you need to modify:</p>
<pre class="brush: css; title: ; notranslate">
#gridcontainer{margin: 20px 0; width: 100%; }
#gridcontainer h2 a{color: #77787a; font-size: 13px;}
#gridcontainer .griditemleft{float: left; width: 278px; margin: 0 40px 40px 0;}
#gridcontainer .griditemright{float: left; width: 278px;}
#gridcontainer .postimage{margin: 0 0 10px 0;}
</pre>
<p>We hope that this tutorial steers you in the right direction towards making a grid loop display for your WordPress posts.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/">How to Create a Grid Display of Post Thumbnails in WordPress Themes</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/09/gridpostdisplay-150x150.gif" />
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2011/09/gridpostdisplay.gif" medium="image">
			<media:title type="html">Grid Post Display</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/09/gridpostdisplay-150x150.gif" />
		</media:content>
	</item>
		<item>
		<title>How to Customize the Display of WordPress Archives in Your Sidebar</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-customize-the-display-of-wordpress-archives-in-your-sidebar/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-customize-the-display-of-wordpress-archives-in-your-sidebar/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 18:05:04 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[customize wordpress archives display]]></category>
		<category><![CDATA[how to separate month from year in wordpress archives code]]></category>
		<category><![CDATA[how to show months without year in wordpress archives]]></category>
		<category><![CDATA[year and month archives wordpress]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=3620</guid>
		<description><![CDATA[<p>Recently, we were working on a client&#8217;s site design that required us to display monthly archives arranged by year in the sidebar. It probably was really easy for their designer to mock it up in Photoshop, but it was a bit complicated to achieve in WordPress. See the image below: Now you are probably wondering why it was tricky to get it into WordPress when wp_get_archives() list the archives monthly with the year next to it? Well that is because...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-customize-the-display-of-wordpress-archives-in-your-sidebar/">How to Customize the Display of WordPress Archives in Your Sidebar</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently, we were working on a client&#8217;s site design that required us to display monthly archives arranged by year in the sidebar. It probably was really easy for their designer to mock it up in Photoshop, but it was a bit complicated to achieve in WordPress. See the image below:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay.gif" alt="Custom Archives Display in WordPress Sidebar" title="Custom Archives Display in WordPress Sidebar" width="520" height="275" class="alignnone size-full wp-image-3621" /></p>
<p>Now you are probably wondering why it was tricky to get it into WordPress when <a href="http://codex.wordpress.org/Template_Tags/wp_get_archives" title="wp_get_archives codex reference" target="_blank" rel="nofollow">wp_get_archives()</a> list the archives monthly with the year next to it? Well that is because this client only wanted to show the year once on it&#8217;s left. There is no real way to customize the styling of the wp_get_archives() function.</p>
<p>We looked around the web for solutions and came across nothing. This issue has to be really rare however we found that <a href="http://floatleft.com/notebook/wordpress-year-month-archives/" title="Andrew Appleton - WordPress Year and Month Archives" target="_blank" rel="nofollow">Andrew Appleton</a> had the similar issue, and he had a fix for it. We used his codes with a small bits of modification. </p>
<p>Andrew&#8217;s code did not have a limit parameter for the archives. So using his codes would mean that you will show all archives month. Imagine that for a blog that is 5 years old. So we added a limit parameter which allowed us to limit the number of months displayed to 18 at any given time.</p>
<p>So basically what you need to do is paste the following code in your theme&#8217;s <em>sidebar.php</em> file or any other file where you want to display custom WordPress archives:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
global $wpdb;
$limit = 0;
$year_prev = null;
$months = $wpdb-&gt;get_results(&quot;SELECT DISTINCT MONTH( post_date ) AS month ,	YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb-&gt;posts WHERE post_status = 'publish' and post_date &lt;= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC&quot;);
foreach($months as $month) :
	$year_current = $month-&gt;year;
	if ($year_current != $year_prev){
		if ($year_prev != null){?&gt;

		&lt;?php } ?&gt;

	&lt;li class=&quot;archive-year&quot;&gt;&lt;a href=&quot;&lt;?php bloginfo('url') ?&gt;/&lt;?php echo $month-&gt;year; ?&gt;/&quot;&gt;&lt;?php echo $month-&gt;year; ?&gt;&lt;/a&gt;&lt;/li&gt;

	&lt;?php } ?&gt;
	&lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo('url') ?&gt;/&lt;?php echo $month-&gt;year; ?&gt;/&lt;?php echo date(&quot;m&quot;, mktime(0, 0, 0, $month-&gt;month, 1, $month-&gt;year)) ?&gt;&quot;&gt;&lt;span class=&quot;archive-month&quot;&gt;&lt;?php echo date(&quot;F&quot;, mktime(0, 0, 0, $month-&gt;month, 1, $month-&gt;year)) ?&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;?php $year_prev = $year_current;

if(++$limit &gt;= 18) { break; }

endforeach; ?&gt;
</pre>
<p>Note: If you want to change the number of months displayed, then you need to change line 19 where the current $limit value is set to 18.</p>
<p>Our CSS looked a bit like this:</p>
<pre class="brush: css; title: ; notranslate">
.widget-archive{padding: 0 0 40px 0; float: left; width: 235px;}
.widget-archive ul {margin: 0;}
.widget-archive li {margin: 0; padding: 0;}
.widget-archive li a{ border-left: 1px solid #d6d7d7; padding: 5px 0 3px 10px; margin: 0 0 0 55px; display: block;}
li.archive-year{float: left; font-family: Helvetica, Arial, san-serif; padding: 5px 0 3px 10px; color:#ed1a1c;}
li.archive-year a{color:#ed1a1c; margin: 0; border: 0px; padding: 0;}
</pre>
<p>So by doing it this way, we had the final outcome to look like this:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay.gif" alt="Custom Archives Display in WordPress Sidebar" title="Custom Archives Display in WordPress Sidebar" width="520" height="275" class="alignnone size-full wp-image-3621" /></p>
<p>Now if you want to show the count of posts in each month, then you would need to add this bit of code anywhere in between line 12 &#8211; 16 of the above code:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php echo $month-&gt;post_count; ?&gt;</pre>
<p>One example of what you can do with the post count and everything can be seen in the image below:</p>
<p><img src="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay2.gif" alt="Custom WordPress Archives Display with Post Count" title="Custom WordPress Archives Display with Post Count" width="520" height="197" class="alignnone size-full wp-image-3623" /></p>
<p>The above picture was taken from <a href="http://floatleft.com/notebook/wordpress-year-month-archives/" title="Andrew Appleton - WordPress Year and Month Archives" target="_blank" rel="nofollow">Andrew Appleton&#8217;s site</a> because that was the solution he came up with from which we derived our style. If you want to see the css for his styles, then simply click on his website link above.</p>
<p>Do you know of an easier way of accomplishing this? Will you be customizing the display of your WordPress Archives in the next design? Please share your thoughts in the comment box below.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-customize-the-display-of-wordpress-archives-in-your-sidebar/">How to Customize the Display of WordPress Archives in Your Sidebar</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-customize-the-display-of-wordpress-archives-in-your-sidebar/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay-150x150.gif" />
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay.gif" medium="image">
			<media:title type="html">Custom Archives Display in WordPress Sidebar</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay-150x150.gif" />
		</media:content>
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay.gif" medium="image">
			<media:title type="html">Custom Archives Display in WordPress Sidebar</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay-150x150.gif" />
		</media:content>
		<media:content url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay2.gif" medium="image">
			<media:title type="html">Custom WordPress Archives Display with Post Count</media:title>
			<media:thumbnail url="http://cdn.wpbeginner.com/wp-content/uploads/2011/08/customarchivesdisplay2-150x150.gif" />
		</media:content>
	</item>
		<item>
		<title>How to Show Limited Number of Tags after Posts in your WordPress Theme</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-show-limited-number-of-tags-after-posts-in-your-wordpress-theme/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-show-limited-number-of-tags-after-posts-in-your-wordpress-theme/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 14:50:41 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[how to show limited number of tags after each posts in wordpress themes]]></category>
		<category><![CDATA[limit number of post tags in theme]]></category>
		<category><![CDATA[limit number of tags in theme]]></category>
		<category><![CDATA[show limited number of tags after each post in wordpress theme]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=3580</guid>
		<description><![CDATA[<p>Recently we were asked how to display a limited number of tags after each post in your WordPress theme. Normally, you use a function the_tags() to display a link to the tags a post belongs to. However that function does not have a parameter to limit the number of tags displayed. So if your post has 12 tags, and your theme only has space for 5, then it might not look so good in the design. A lot of folks...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-show-limited-number-of-tags-after-posts-in-your-wordpress-theme/">How to Show Limited Number of Tags after Posts in your WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently we were asked how to display a limited number of tags after each post in your WordPress theme. Normally, you use a function <a href="http://codex.wordpress.org/Function_Reference/the_tags" title="the_tags() codes page" target="_blank" rel="nofollow">the_tags()</a> to display a link to the tags a post belongs to. However that function does not have a parameter to limit the number of tags displayed. So if your post has 12 tags, and your theme only has space for 5, then it might not look so good in the design. A lot of folks just limit the usage of tags, or don&#8217;t even include it in the templates. But in this article, we will show you how you can limit the number of tags after posts in your WordPress theme without limiting the number of tags you add to each post.</p>
<p>Edit: Apparently after writing this article, the most awesome Otto (@otto42) replied on my <a href="https://plus.google.com/u/0/101623299936375408403/posts" title="Syed Balkhi on Google+" target="_blank" rel="nofollow">Google+ account</a> to let me know that there is a simpler way of accomplishing this.</p>
<p>First you need to open your theme&#8217;s <em>functions.php</em> file and add this function:</p>
<pre class="brush: php; title: ; notranslate">
add_filter('term_links-post_tag','limit_to_five_tags');
function limit_to_five_tags($terms) {
return array_slice($terms,0,5,true);
}
</pre>
<p>You can change the 5 number to maximum count you want.</p>
<p>Then open your loop.php, single.php, index.php, or wherever you want to add these post tags (must be inside a post loop), then paste the following code:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php the_tags() ?&gt;</pre>
<p>This is definitely a lot simpler than what I had come up with which I will leave in this post for those who care.</p>
<h4>Old Complicated Method</h4>
<p>All you need to do is paste the following code in your theme file (inside the post loop):</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$posttags = get_the_tags();
$count=0; $sep='';
if ($posttags) {
	echo 'Tags: ';
	foreach($posttags as $tag) {
		$count++;
		echo $sep . '&lt;a href=&quot;'.get_tag_link($tag-&gt;term_id).'&quot;&gt;'.$tag-&gt;name.'&lt;/a&gt;';
$sep = ', ';
		if( $count &gt; 5 ) break; //change the number to adjust the count
	}
}
?&gt;
</pre>
<p>The code above will display 6 tags in the theme. If you want to show less tags or more tags, simply adjust the $count > 5 line with the number you want. Remember, even though the count number says greater than 5, we see 6 tags. That is because the count is starting at 0. So if you want to show only 4 tags, then the number would need to be 3.</p>
<p>If you want to change the separator, then you need to change line 9. The current code will separate by commas. You can also customize the styling by adding divs, list elements, or anything else that you like.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-show-limited-number-of-tags-after-posts-in-your-wordpress-theme/">How to Show Limited Number of Tags after Posts in your WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-show-limited-number-of-tags-after-posts-in-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
	</item>
		<item>
		<title>How to Display the Facebook Comment Count in WordPress Theme</title>
		<link>http://www.wpbeginner.com/wp-themes/how-to-display-the-facebook-comment-count-in-wordpress-theme/</link>
		<comments>http://www.wpbeginner.com/wp-themes/how-to-display-the-facebook-comment-count-in-wordpress-theme/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 21:32:42 +0000</pubDate>
		<dc:creator>Editorial Staff</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[how to show facebook comment count]]></category>
		<category><![CDATA[show facebook comment count in wordpress]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=3565</guid>
		<description><![CDATA[<p>Recently, we showed you how to setup facebook comments for WordPress. One of the downside of using that plugin is that it overtakes all WordPress comment_count functions, and it outputs a facebook branded version of the comment count. This may cause issues to your WordPress design specially if you are using a comment bubble to just display the number. In this article, we will show you how to display the facebook comment count in your WordPress theme. All you have...</p><p><a href="http://www.wpbeginner.com/wp-themes/how-to-display-the-facebook-comment-count-in-wordpress-theme/">How to Display the Facebook Comment Count in WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently, we showed you <a href="http://www.wpbeginner.com/plugins/how-to-install-and-setup-facebook-comments-in-wordpress" title="How to add facebook comments in WordPress">how to setup facebook comments for WordPress</a>. One of the downside of using that plugin is that it overtakes all WordPress comment_count functions, and it outputs a facebook branded version of the comment count. This may cause issues to your WordPress design specially if you are using a comment bubble to just display the number. In this article, we will show you how to display the facebook comment count in your WordPress theme. </p>
<p>All you have to do is paste the following code in your theme file where you want to display the comment count:</p>
<pre class="brush: php; title: ; notranslate">
&lt;fb:comments-count href=&quot;&lt;?php echo get_permalink($post-&gt;ID); ?&gt;&quot;&gt;&lt;/fb:comments-count&gt; Comments
</pre>
<p>Hope you will find this handy while designing your WordPress themes.</p>
<p><a href="http://www.wpbeginner.com/wp-themes/how-to-display-the-facebook-comment-count-in-wordpress-theme/">How to Display the Facebook Comment Count in WordPress Theme</a> is a post from: <a href="http://www.wpbeginner.com" target="_blank" rel="friend">WPBeginner</a> which is not allowed to be copied on other sites.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpbeginner.com/wp-themes/how-to-display-the-facebook-comment-count-in-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
	</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Content Delivery Network via cdn.wpbeginner.com

Served from: www.wpbeginner.com @ 2012-02-08 18:25:21 -->
