<?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/"
	>

<channel>
	<title>WP First Aid &#187; Functions</title>
	<atom:link href="http://wpfirstaid.com/category/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpfirstaid.com</link>
	<description>It&#039;s WordPress ... anything is possible!</description>
	<lastBuildDate>Tue, 17 Jan 2012 16:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Remove Comment Form Website Section</title>
		<link>http://wpfirstaid.com/2012/01/remove-comment-form-website-section/</link>
		<comments>http://wpfirstaid.com/2012/01/remove-comment-form-website-section/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 16:47:01 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[add_filter]]></category>
		<category><![CDATA[comment_form]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=1122</guid>
		<description><![CDATA[From time to time an interesting Five-Minute-FixTM comes along that sparks a great reason to add another WordPress Tips post. The idea for this tip started with this comment at BuyNowShop.com: &#8230; how to remove the website section when leaving a reply/comment &#8230; The solution may be obvious to some and can be readily derived [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time an interesting <a href="http://buynowshop.com/five-minute-fix/" title="Five Minute Fix @ BuyNowShop">Five-Minute-Fix<sup>TM</sup></a> comes along that sparks a great reason to add another <a href="http://wpfirstaid.com/category/tips/" title="WPFirstAid WordPress Tips">WordPress Tips</a> post. The idea for this tip started with <a href="http://buynowshop.com/five-minute-fix/comment-page-1/#comment-11155">this comment</a> at <a href="http://buynowshop.com/" title="BuyNowShop.com">BuyNowShop.com</a>:</p>
<blockquote><p>&#8230; how to remove the website section when leaving a reply/comment &#8230;</p></blockquote>
<p>The solution may be obvious to some and can be readily derived from the information found on the WordPress codex page for the `<a href="http://codex.wordpress.org/Function_Reference/comment_form" title="Codex: comment_form">comment_form</a>` function, but if you are new to <a href="http://wordpress.org/" title="WordPress-dot-org">WordPress</a> and/or not familiar with writing a function to use with `<a href="http://codex.wordpress.org/Function_Reference/add_filter" title="Codex: add_filter">add_filter</a>`, here is a very simple and working snippet to use in your theme:</p>
<div class="aside-toggler open"><span class="open-aside tip">To see the <em>tip</em> click here.</span><span class="close-aside tip">To hide the <em>tip</em> click here.</span>
                         </div><div class="bnsia aside tip open">
<pre class="brush: php; title: ; notranslate">
function wpfa_remove_comment_website_section(){
    $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? &quot; aria-required='true'&quot; : '' );
    $fields =  array(
        'author' =&gt; '&lt;p class=&quot;comment-form-author&quot;&gt;' . '&lt;label for=&quot;author&quot;&gt;' . __( 'Name' ) . '&lt;/label&gt; ' . ( $req ? '&lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;' : '' ) .
                    '&lt;input id=&quot;author&quot; name=&quot;author&quot; type=&quot;text&quot; value=&quot;' . esc_attr( $commenter['comment_author'] ) . '&quot; size=&quot;30&quot;' . $aria_req . ' /&gt;&lt;/p&gt;',
        'email'  =&gt; '&lt;p class=&quot;comment-form-email&quot;&gt;&lt;label for=&quot;email&quot;&gt;' . __( 'Email' ) . '&lt;/label&gt; ' . ( $req ? '&lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;' : '' ) .
                    '&lt;input id=&quot;email&quot; name=&quot;email&quot; type=&quot;text&quot; value=&quot;' . esc_attr(  $commenter['comment_author_email'] ) . '&quot; size=&quot;30&quot;' . $aria_req . ' /&gt;&lt;/p&gt;',
        'url'    =&gt; '' /** removes website section */,
    );
    return $fields;
}
add_filter( 'comment_form_default_fields', 'wpfa_remove_comment_website_section' );
</pre>
<p></div><script type="text/javascript">
            /* <![CDATA[ */
            jQuery( document ).ready( function(){
                jQuery( ".aside-toggler" ).click( function(){
                    jQuery( this ).toggleClass( "open" ).toggleClass( "closed" ).next( ".aside" ).slideToggle( "slow", function(){
                        jQuery( this ).toggleClass( "open" ).toggleClass( "closed" );
                    });
                });
            });
            /* ]]&gt; */
            </script>
<p>Ideally, this will be placed in the &#8216;functions.php&#8217; file of your theme, but better yet this should be included in the <a href="http://wpfirstaid.com/2011/04/wordpress-child-themes/" title="WordPress Child-Themes">Child-Theme</a> you created of the theme you want to modify.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2012/01/remove-comment-form-website-section/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do Not Display Comments HTML Tags</title>
		<link>http://wpfirstaid.com/2011/08/do-not-display-comments-html-tags/</link>
		<comments>http://wpfirstaid.com/2011/08/do-not-display-comments-html-tags/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 22:24:54 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[comment_form]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=1052</guid>
		<description><![CDATA[A standard function found in many themes is the comment_form. This is a core function of WordPress that produces a standard comment form generally consisting of text fields for the name and email address and a textarea for the actual comment. You will also find there are some standard text outputs produced by this function [...]]]></description>
			<content:encoded><![CDATA[<p>A standard function found in many themes is the <em>comment_form</em>. This is a <a href="http://codex.wordpress.org/Function_Reference/comment_form" title="Codex: comment_form">core function</a> of <a href="http://wordpress.org" title="WordPress">WordPress</a> that produces a standard comment form generally consisting of text fields for the name and email address and a textarea for the actual comment. You will also find there are some standard text outputs produced by this function as well, one of those is the allowed HTML tags that can be used in the form.</p>
<pre>You may use these HTML tags and attributes: &lt;a href="" title=""> &lt;abbr title=""> &lt;acronym title=""> &lt;b> &lt;blockquote cite=""> &lt;cite> &lt;code> &lt;del datetime=""> &lt;em> &lt;i> &lt;q cite=""> &lt;strike> &lt;strong></pre>
<p>If you do not want to display this text it is actually very easy to do. It can be done with a line of CSS or a minor edit to the theme in question. The following is based on using the comment_form function in its default state:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php comment_form(); ?&gt;</pre>
<p>To hide the message above with CSS, add one of the following to the end of your style.css file:</p>
<pre class="brush: css; title: ; notranslate">p.form-allowed-tags { display: none; }</pre>
<pre class="brush: css; title: ; notranslate">p.form-allowed-tags { visibility: hidden; }</pre>
<p>Using the display property &#8220;removes&#8221; the block of text whereas using the visibility property simply &#8220;hides&#8221; the text leaving the block being filled with nothing. Which method is best will be more due to aesthetics than anything else.</p>
<p>If you want to edit your theme files, look into the comments.php template file (again a standard default naming convention, your theme may vary), and find the default code noted above and change it to the following:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php comment_form( 'comment_notes_after=' ); ?&gt;</pre>
<p>Always remember, any edits you make to the theme may be over-written with the theme&#8217;s next update &#8230; always back-up your work.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2011/08/do-not-display-comments-html-tags/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>the_widget() as a Shortcode Base</title>
		<link>http://wpfirstaid.com/2010/09/the_widget-shortcode-base/</link>
		<comments>http://wpfirstaid.com/2010/09/the_widget-shortcode-base/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 23:53:31 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[add_shortcode]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[the_widget]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=787</guid>
		<description><![CDATA[This post will further expand on the possible uses of the_widget() as the basis of the code you can use to create a shortcode for a WordPress sidebar widget.]]></description>
			<content:encoded><![CDATA[<p>In January 2010 I <a href="http://wp.me/pIDVu-3B">wrote a post</a> about making a template tag for standard plugins using the built-in <a href="http://wordpress.org">WordPress</a> function <em><a href="http://codex.wordpress.org/Function_Reference/the_widget">the_widget()</a></em>. This post will further expand on the possible uses of <em>the_widget()</em> as the basis of the code you can use to create a <em><a href="http://codex.wordpress.org/Shortcode_API">shortcode</a></em>. <em>Shortcodes</em> are well described in the WordPress codex as:</p>
<blockquote><p>&#8230; macro codes for use in post content.<br />
<cite><a href="http://codex.wordpress.org/Shortcode_API">Shortcode API</a></cite></p></blockquote>
<p>We will be using the same sample code from the previous post: <a class="downloadlink" href="http://wpfirstaid.com/wp-downloads/wpfa-sample-widget1.zip" title="Version0.2 downloaded 164 times" >WPFirstAid Sample Widget (164)</a></p>
<p>We have actually done all the heavy lifting to add the appropriate code to the sample widget when we worked out the code to use <em>the_widget()</em> as a template tag.</p>
<p>Let&#8217;s jump right in. We start with the basic &#8220;template tag&#8221; code:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php /* Using the_widget() to make a plugin template tag */
the_widget(
  WPFA_Sample_Widget,
  $instance = array(
        'title'                 =&gt; __('WPFirstAid Sample'),
        'choices'               =&gt; 'The Doctor',
        'show_choices'          =&gt; true,
        'optionals'             =&gt; 'right'
  ),
  $args = array (
  'before_widget'   =&gt; '',
  'before_title'    =&gt; '',
  'after_title'     =&gt; '',
  'after_widget'    =&gt; ''
  )
);
/* NB: This will work, now! */ ?&gt;
</pre>
<p>Then we will add the necessary code to use it as a function:</p>
<pre class="brush: php; highlight: [6,11]; title: ; notranslate">&lt;?php
function wpfa_sample_shortcode ($atts) {
  /* Using the_widget() to make a plugin template tag */
  the_widget(
    WPFA_Sample_Widget,
    $instance = shortcode_atts( array(
          'title'                 =&gt; __('WPFirstAid Sample'),
          'choices'               =&gt; 'The Doctor',
          'show_choices'          =&gt; true,
          'optionals'             =&gt; 'right'
    ), $atts ),
    $args = array (
    'before_widget'   =&gt; '',
    'before_title'    =&gt; '',
    'after_title'     =&gt; '',
    'after_widget'    =&gt; ''
    )
  );
}
?&gt;
</pre>
<p>Notice lines 6 and 11 above are highlighted. This is the key difference in the code to allow for the <em>shortcode</em> to have working options directly related to the widget.</p>
<p>Now we need to add the necessary code to capture the output and return it. Then we need to add the final line of code, <em><a href="http://codex.wordpress.org/Function_Reference/add_shortcode">add_shortcode()</a></em>, to complete this section. Note the highlighted lines below:</p>
<pre class="brush: php; highlight: [3,20,21,23,25]; title: ; notranslate">&lt;?php
function wpfa_sample_shortcode ($atts) {
  ob_start(); /* Start capture */
  /* Using the_widget() to make a plugin template tag */
  the_widget(
    WPFA_Sample_Widget,
    $instance = shortcode_atts( array(
          'title'                 =&gt; __('WPFirstAid Sample'),
          'choices'               =&gt; 'The Doctor',
          'show_choices'          =&gt; true,
          'optionals'             =&gt; 'right'
    ), $atts ),
    $args = array (
    'before_widget'   =&gt; '',
    'before_title'    =&gt; '',
    'after_title'     =&gt; '',
    'after_widget'    =&gt; ''
    )
  );
  $wpfa_sample_output = ob_get_contents(); /* Captured output */
  ob_end_clean(); /* Stop capture */

  return $wpfa_sample_output;
}
add_shortcode( 'wpfa_sample', 'wpfa_sample_shortcode' );
?&gt;
</pre>
<p>Now we are ready to add the above code to the end of the sample widget code. In this particular case, the lines 2 through 25 (inclusive) can be copied and pasted at the end of the &#8216;wpfa-sample-widget.php&#8217; file, just before the close <code>?></code> tag. Below the line is the shortcode (slightly customized) in action. Enjoy!</p>
<hr class="hr" />
  <div class="wpfa-sample-shortcode">
  <h2 class="widgettitle">WPFirstAid Sample</h2>The Doctor is in ... step to your left  </div><!-- .wpfa-sample-shortcode -->
  
<hr class="hr" />
<div class="nota-bene">NB: The sample widget code download now also contains the shortcode modifications. Here is the link again: <a class="downloadlink" href="http://wpfirstaid.com/wp-downloads/wpfa-sample-widget1.zip" title="Version0.2 downloaded 164 times" >WPFirstAid Sample Widget (164)</a></div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/09/the_widget-shortcode-base/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Implementation of wp_nav_menu</title>
		<link>http://wpfirstaid.com/2010/09/implement-wp_nav_menu/</link>
		<comments>http://wpfirstaid.com/2010/09/implement-wp_nav_menu/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 01:49:48 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[register_nav_menu]]></category>
		<category><![CDATA[wp_list_pages]]></category>
		<category><![CDATA[wp_nav_menu]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=716</guid>
		<description><![CDATA[This article will show how to implement the wp_nav_menu() function using the wp_list_pages() function as a fallback.]]></description>
			<content:encoded><![CDATA[<p>Please note, this might be considered a &#8220;Go Big, or Go Home&#8221; exercise. Please read this entire post before attempting this at home, or on your own site or theme.</p>
<p>This article will be covering the implementation of the <em>wp_nav_menu()</em> function using the <em>wp_list_pages()</em> function as a fallback. The menu will also be centered and support full drop down sub-menu items, or child pages as some would refer to them &#8230; and, the menu system now live on this site, too.</p>
<p>The following code will also be released in the free <a href="http://wordpress.org/">WordPress</a> Theme <a href="http://buynowshop.com/themes/shades/">Shades</a> at version 1.6, and it will also be the basis for the examples used in this post.</p>
<p>Let&#8217;s get started &#8230;</p>
<h3>What We Need</h3>
<ul>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu()</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/register_nav_menu">register_nav_menu()</a></li>
<li><a href="http://wp.me/pIDVu-9q">Upgrade wp_list_pages() to wp_nav_menu()</a></li>
<li><a href="http://wordpress.org/extend/themes/shades">Shades</a></li>
<li><a href="http://matthewjamestaylor.com/blog/centered-dropdown-menus">CSS</a></li>
</ul>
<p>Have a look at the codex pages above for <em><a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a></em>, <em><a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu</a></em>, and <em><a href="http://codex.wordpress.org/Function_Reference/register_nav_menu">register_nav_menu</a></em> to get (more) familiar with the basics of these functions. As this has to do with the use of <em>wp_list_pages()</em> reading the article &#8220;<a href="http://wp.me/pIDVu-9q">Upgrade wp_list_pages() to wp_nav_menu()</a>&#8221; may also prove useful.</p>
<p>Although not absolutely necessary, getting a copy of the <a href="http://wordpress.org/extend/themes/shades">Shades</a> theme may be handy if you wish to look at the code directly rather than the examples and snippets to follow.</p>
<p>The last part is the CSS to make it all work. This is from a great article written by <a href="http://matthewjamestaylor.com/">Matthew James Taylor</a> and can be found <a href="http://matthewjamestaylor.com/blog/centered-dropdown-menus">here</a>.</p>
<p>On the next page we will look at what to do &#8230;</p>
<h3>What We Will Do</h3>
<p>First we are going to open the functions.php template file and start with adding the following code:</p>
<pre class="brush: php; first-line: 99; title: ; notranslate">
wp_nav_menu( array(
   'theme_location' =&gt; 'top-menu',
   'fallback_cb' =&gt; 'custom_list_pages'
   ) );
</pre>
<p>Next we will need to incorporate the fallback menu code via wp_list_pages(), with the following:</p>
<pre class="brush: php; first-line: 107; title: ; notranslate">
function custom_list_pages() {
  if ( is_home() || is_front_page() ) { ?&gt;
    &lt;ul&gt;&lt;?php wp_list_pages( 'title_li=' ); ?&gt;&lt;/ul&gt;
  &lt;?php } else { ?&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo( 'url' ); ?&gt;&quot;&gt;&lt;?php _e( 'Home' ); ?&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;?php wp_list_pages( 'title_li=' ); ?&gt;
    &lt;/ul&gt;
  &lt;?php }
}
</pre>
<p>Both of these functions will need to be included in the custom function that will be the base of our new menu system. The code looks like this:</p>
<pre class="brush: php; first-line: 97; title: ; notranslate">
function custom_nav_menu() {
    if ( function_exists( 'wp_nav_menu' ) )
      wp_nav_menu( array(
			   'theme_location' =&gt; 'top-menu',
			   'fallback_cb' =&gt; 'custom_list_pages'
			   ) );
    else
      custom_list_pages();
}
</pre>
<p>Then we need to register the custom function and give it a place to live. This code will accomplish that:</p>
<pre class="brush: php; first-line: 118; title: ; notranslate">
add_action( 'init', 'register_custom_menu' );
function register_custom_menu() {
    register_nav_menu( 'top-menu', __( 'Top Menu' ) );
}
</pre>
<p>The heavy lifting is done, now we need to address the actual display of the menu. Let&#8217;s open the header.php template file and place the custom function appropriately.</p>
<pre class="brush: php; first-line: 34; title: ; notranslate">
&lt;div id=&quot;centeredmenu&quot;&gt;
	&lt;?php custom_nav_menu(); ?&gt;
&lt;/div&gt; &lt;!-- #centeredmenu --&gt;
</pre>
<p>Now for all intent and purpose the CSS from Matthew James Taylor&#8217;s post can be dropped into the style.css file, like so:</p>
<pre class="brush: css; first-line: 202; title: ; notranslate">
/* Main menu settings */
#centeredmenu {
   clear:both;
   float:left;
   margin:0;
   padding:0;
   border-bottom:1px solid #000; /* black line below menu */
   width:100%;
   font-family:Verdana, Geneva, sans-serif; /* Menu font */
   font-size:90%; /* Menu text size */
   z-index:1000; /* This makes the dropdown menus appear above the page content below */
   position:relative;
}

/* Top menu items */
#centeredmenu ul {
   margin:0;
   padding:0;
   list-style:none;
   float:right;
   position:relative;
   right:50%;
}
#centeredmenu ul li {
   margin:0 0 0 1px;
   padding:0;
   float:left;
   position:relative;
   left:50%;
   top:1px;
}
#centeredmenu ul li a {
   display:block;
   margin:0;
   padding:.6em .5em .4em;
   font-size:1em;
   line-height:1em;
   background:#ddd;
   text-decoration:none;
   color:#444;
   font-weight:bold;
   border-bottom:1px solid #000;
}
#centeredmenu ul li.active a {
   color:#fff;
   background:#000;
}
#centeredmenu ul li a:hover {
   background:#36f; /* Top menu items background colour */
   color:#fff;
   border-bottom:1px solid #03f;
}
#centeredmenu ul li:hover a,
#centeredmenu ul li.hover a { /* This line is required for IE 6 and below */
   background:#36f; /* Top menu items background colour */
   color:#fff;
   border-bottom:1px solid #03f;
}

/* Submenu items */
#centeredmenu ul ul {
   display:none; /* Sub menus are hiden by default */
   position:absolute;
   top:2em;
   left:0;
   right:auto; /*resets the right:50% on the parent ul */
   width:10em; /* width of the drop-down menus */
}
#centeredmenu ul ul li {
   left:auto;  /*resets the left:50% on the parent li */
   margin:0; /* Reset the 1px margin from the top menu */
   clear:left;
   width:100%;
}
#centeredmenu ul ul li a,
#centeredmenu ul li.active li a,
#centeredmenu ul li:hover ul li a,
#centeredmenu ul li.hover ul li a { /* This line is required for IE 6 and below */
   font-size:.8em;
   font-weight:normal; /* resets the bold set for the top level menu items */
   background:#eee;
   color:#444;
   line-height:1.4em; /* overwrite line-height value from top menu */
   border-bottom:1px solid #ddd; /* sub menu item horizontal lines */
}
#centeredmenu ul ul li a:hover,
#centeredmenu ul li.active ul li a:hover,
#centeredmenu ul li:hover ul li a:hover,
#centeredmenu ul li.hover ul li a:hover { /* This line is required for IE 6 and below */
   background:#36f; /* Sub menu items background colour */
   color:#fff;
}

/* Flip the last submenu so it stays within the page */
#centeredmenu ul ul.last {
   left:auto; /* reset left:0; value */
   right:0; /* Set right value instead */
}

/* Make the sub menus appear on hover */
#centeredmenu ul li:hover ul,
#centeredmenu ul li.hover ul { /* This line is required for IE 6 and below */
   display:block; /* Show the sub menus */
}
</pre>
<p>Although this will work as is in most cases there are a few items that can be modified to better suit a theme. On the next page is the actual CSS being used in the <a href="http://buynowshop.com/themes/shades/">Shades</a> theme, version 1.6, to accommodate its requirements as well as meeting current theme review criteria as noted on the WordPress codex page <a href="http://codex.wordpress.org/Theme_Review">here</a>.</p>
<h3>What May Need To Be Adjusted</h3>
<p>Note the changes at the following lines: 231, 251, 254, 259, 262, 296, and especially 310 for multiple line menus.</p>
<pre class="brush: css; first-line: 202; highlight: [231,251,254,259,262,296,310]; title: ; notranslate">
/* Main menu settings */
#centeredmenu {
   clear:both;
   float:left;
   margin:0;
   padding:0;
   border-bottom:1px solid #000; /* black line below menu */
   width:100%;
   font-family:Verdana, Geneva, sans-serif; /* Menu font */
   font-size:90%; /* Menu text size */
   z-index:1000; /* This makes the dropdown menus appear above the page content below */
   position:relative;
}

/* Top menu items */
#centeredmenu ul {
   margin:0;
   padding:0;
   list-style:none;
   float:right;
   position:relative;
   right:50%;
}
#centeredmenu ul li {
   margin:0 0 0 1px;
   padding:0;
   float:left;
   position:relative;
   left:50%;
   /* top:1px; */
}
#centeredmenu ul li a {
   display:block;
   margin:0;
   padding:.6em .5em .4em;
   font-size:1em;
   line-height:1em;
   background:#ddd;
   text-decoration:none;
   color:#444;
   font-weight:bold;
   border-bottom:1px solid #000;
}
#centeredmenu ul li.active a {
   color:#fff;
   background:#000;
}
#centeredmenu ul li a:hover {
   /* background:#36f; /* Top menu items background colour */
   background: #8c8c8c;
   color:#fff;
   /* border-bottom:1px solid #03f; */
   border-bottom:1px solid #444;
}
#centeredmenu ul li:hover a,
#centeredmenu ul li.hover a { /* This line is required for IE 6 and below */
   /* background:#36f; /* Top menu items background colour */
   background: #8c8c8c;
   color:#fff;
   /* border-bottom:1px solid #03f; */
   border-bottom:1px solid #444;
}

/* Submenu items */
#centeredmenu ul ul {
   display:none; /* Sub menus are hiden by default */
   position:absolute;
   top:2em;
   left:0;
   right:auto; /*resets the right:50% on the parent ul */
   width:10em; /* width of the drop-down menus */
}
#centeredmenu ul ul li {
   left:auto;  /*resets the left:50% on the parent li */
   margin:0; /* Reset the 1px margin from the top menu */
   clear:left;
   width:100%;
}
#centeredmenu ul ul li a,
#centeredmenu ul li.active li a,
#centeredmenu ul li:hover ul li a,
#centeredmenu ul li.hover ul li a { /* This line is required for IE 6 and below */
   font-size:.8em;
   font-weight:normal; /* resets the bold set for the top level menu items */
   background:#eee;
   color:#444;
   line-height:1.4em; /* overwrite line-height value from top menu */
   border-bottom:1px solid #ddd; /* sub menu item horizontal lines */
}
#centeredmenu ul ul li a:hover,
#centeredmenu ul li.active ul li a:hover,
#centeredmenu ul li:hover ul li a:hover,
#centeredmenu ul li.hover ul li a:hover { /* This line is required for IE 6 and below */
   /* background:#36f; /* Sub menu items background colour */
   background: #8c8c8c;
   color:#fff;
}

/* Flip the last submenu so it stays within the page */
#centeredmenu ul ul.last {
   left:auto; /* reset left:0; value */
   right:0; /* Set right value instead */
}

/* Make the sub menus appear on hover */
#centeredmenu ul li:hover ul,
#centeredmenu ul li.hover ul { /* This line is required for IE 6 and below */
   display:block; /* Show the sub menus */
   z-index: 1500; /* Required for multi-line menus */
}

/* -- Extra Window Dressings -- */
#centeredmenu ul li a {
  /* optional rounded corners for browsers that support it */
  -moz-border-radius: 5px 5px 0 0;
  -khtml-border-radius: 5px 5px 0 0;
  -webkit-border-radius: 5px 5px 0 0;
  border-radius: 5px 5px 0 0;
}

#centeredmenu ul li:first-child a { /* First parent menu item */
  /* optional rounded corners for browsers that support it */
  -moz-border-radius: 10px 5px 0 0;
  -khtml-border-radius: 10px 5px 0 0;
  -webkit-border-radius: 10px 5px 0 0;
  border-radius: 10px 5px 0 0;
}

#centeredmenu ul li:last-child a { /* Last parent menu item */
  /* optional rounded corners for browsers that support it */
  -moz-border-radius: 5px 10px 0 0;
  -khtml-border-radius: 5px 10px 0 0;
  -webkit-border-radius: 5px 10px 0 0;
  border-radius: 5px 10px 0 0;
}

#centeredmenu ul ul li:last-child a { /* remove rounded corners from sub-menu items */
  /* optional rounded corners for browsers that support it */
  -moz-border-radius: 0;
  -khtml-border-radius: 0;
  -webkit-border-radius: 0;
  border-radius: 0;
}

#centeredmenu ul ul ul li a { /* &quot;grandchild&quot; sub-menu items */
  padding-left: 10px;
}
</pre>
<p>A little extra was added at the end of the CSS to add some rounded corner emphasis to the top menu tabs as well as some additional padding for sub-sub-menu items.</p>
<p>Thanks again to <a href="http://matthewjamestaylor.com/about">Mathew James Taylor</a> for the great CSS.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/09/implement-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Add the_shortlink()</title>
		<link>http://wpfirstaid.com/2010/07/add-the_shortlink/</link>
		<comments>http://wpfirstaid.com/2010/07/add-the_shortlink/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 20:20:35 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[the_shortlink]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=698</guid>
		<description><![CDATA[I believe there are many reasons for themes to use this function or add it to your WordPress web site. I will briefly discuss a couple of the ones that come to mind. Note, if you are using the default permalink structure this may not be for you as the_shortlink() creates a URL that looks [...]]]></description>
			<content:encoded><![CDATA[<p>I believe there are many reasons for themes to use this function or add it to your <a href="http://wordpress.org">WordPress</a> web site. I will briefly discuss a couple of the ones that come to mind. Note, if you are using the default <a href="http://codex.wordpress.org/Using_Permalinks">permalink structure</a> this may not be for you as <a href="http://codex.wordpress.org/Function_Reference/the_shortlink"><em>the_shortlink()</em></a> creates a <abbr title="Uniform Resource Locator">URL</abbr> that looks just like it.<sup>1</sup></p>
<p>If you are new to WordPress and are still experimenting with the permalink structure to best fit your needs, you might consider using this function to create internal links for your site. Using the <abbr title="Uniform Resource Locator">URL</abbr> generated by <em>the_shortlink()</em> will always resolve correctly, using the verbose <abbr title="Uniform Resource Locator">URL</abbr> of the permalink structure may cause issues if you change the structure and do not <strong>manually edit all</strong> the internal links you have previously posted.</p>
<p>Please note, by &#8220;internal links&#8221; I am refering to the links used within the content of a post or page on your site pointing to another post or page on your site. A WordPress installation has the &#8220;smarts&#8221; to correctly resolve the links it generates if you change the permalink structure but it will not go back and &#8220;fix&#8221; anything you manually typed yourself as part of your page or post entry.</p>
<p>There is great potential for the user, the designer, and the developer using this function. I recommend adding it to all themes. Here is the most basic default usage of <em>the_shortlink()</em>:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php the_shortlink(); ?&gt;</pre>
<p>This is the code I have decided to use on this site:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php the_shortlink( __('Short Link'), '', ' &amp;#124; ', '' ); ?&gt;</pre>
<p>&#8230; which you can see just after the comments or subscribe link in the post meta details.</p>
<p>Of course you can always use the &#8216;Get Shortlink&#8217; button found on the page and post administration panels to get your shortlink, but making use of this single line of code allows your readers to gain that same benefit, too.</p>
<div class="nota-bene">
<ul>
<li>NB: If you have the <a href="http://wordpress.org/extend/plugins/stats/">WordPress.com Stats</a> plugin installed and activated, the_shortlink() function will use the <a href="http://wp.me">wp.me</a> link shortening service; and, it will retain all of the usefulness I noted above.</li>
</ul>
<ol>
<li>Sept. 9, 2010: Recent testing has shown the &#8220;Get Shortlink&#8221; button on the Edit Post panel will not appear unless a permalink structure other than default is used. This also affects <em>the_shortlink()</em> display functionality.</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/07/add-the_shortlink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade wp_list_categories() to wp_nav_menu()</title>
		<link>http://wpfirstaid.com/2010/07/upgrade-wp_list_categories-to-wp_nav_menu/</link>
		<comments>http://wpfirstaid.com/2010/07/upgrade-wp_list_categories-to-wp_nav_menu/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 13:39:07 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_list_categories]]></category>
		<category><![CDATA[wp_nav_menu]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=659</guid>
		<description><![CDATA[In this third installment in the upgrade to wp_nav_menu() series of posts, I will be dealing with moving from wp_list_categories() to wp_nav_menu(). Let&#8217;s start with the same basic outline and list the default options for each function. We will start with wp_nav_menu() 1 first: We follow with wp_list_categories() 2, 3 which is often wrapped in [...]]]></description>
			<content:encoded><![CDATA[<p>In this third installment in the upgrade to <em>wp_nav_menu()</em> series of posts, I will be dealing with moving from <em>wp_list_categories()</em> to <em>wp_nav_menu()</em>.</p>
<p>Let&#8217;s start with the same basic outline and list the default options for each function. We will start with <em>wp_nav_menu()</em><sup> 1</sup> first:</p>
<pre class="brush: php; title: ; notranslate">
wp_nav_menu( array(
    'menu'              =&gt; '',
    'container'         =&gt; 'div',
    'container_class'   =&gt; '',
    'container_id'      =&gt; '',
    'menu_class'        =&gt; 'menu',
    'menu_id'           =&gt; '',
    'echo'              =&gt; true,
    'fallback_cb'       =&gt; 'wp_page_menu',
    'before'            =&gt; '',
    'after'             =&gt; '',
    'link_before'       =&gt; '',
    'link_after'        =&gt; '',
    'depth'             =&gt; 0,
    'walker'            =&gt; '',
    'theme_location'    =&gt; ''
    ) );
</pre>
<p>We follow with <em>wp_list_categories()</em><sup> 2, 3</sup> which is often wrapped in a &lt;ul class=&#8221;menu&#8221;&gt; tag:</p>
<pre class="brush: php; title: ; notranslate">
&lt;ul class=&quot;menu&quot;&gt;
wp_list_categories( array(
    'include'           =&gt; '',
    'exclude'           =&gt; '',
    'exclude_tree'      =&gt; '',
    'child_of'          =&gt; 0,
    'hide_empty'        =&gt; 1,
    'orderby'           =&gt; 'name',
    'order'             =&gt; 'ASC',
    'use_desc_for_title'=&gt; 1,
    'number'            =&gt; NULL,
    'hierarchical'      =&gt; true,
    'show_count'        =&gt; 0,
    'pad_counts'        =&gt; 0,
    'style'             =&gt; 'list',
    /* 'style' set to list &quot;creates list items for an unordered list&quot; */
    'show_option_all'   =&gt; '',
    'show_option_none'  =&gt; __('No categories'),
    'show_last_update'  =&gt; 0,
    'feed'              =&gt; '',
    'feed_type'         =&gt; '',
    'feed_image'        =&gt; '',
    'current_category'  =&gt; 0,
    'taxonomy'          =&gt; 'category',
    'title_li'          =&gt; __( '' ),
    /* 'title_li' set to '' for menus from the default 'Categories' */
    'echo'              =&gt; 1,
    'depth'             =&gt; 0,
    'walker'            =&gt; 'Walker_Category'
    ) );
&lt;/ul&gt;
</pre>
<p>Here is the break-down of the <em>wp_list_categories()</em> default options from above:</p>
<ul>
<li><code>'include'</code> &#8211; not used</li>
<li><code>'exclude'</code> &#8211; not used</li>
<li><code>'exclude_tree'</code> &#8211; not used</li>
<li><code>'child_of'</code> &#8211; not used</li>
<li><code>'hide_empty'</code> &#8211; not used</li>
<li><code>'orderby'</code> &#8211; not used</li>
<li><code>'order'</code> &#8211; not used</li>
<li><code>'use_desc_for_title'</code> &#8211; not used</li>
<li><code>'number'</code> &#8211; not used</li>
<li><code>'hierarchical'</code> &#8211; not used</li>
<li><code>'show_count'</code> &#8211; not used</li>
<li><code>'pad_counts'</code> &#8211; not used</li>
<li><code>'style'</code> &#8211; not used</li>
<li><code>'show_option_all'</code> &#8211; not available</li>
<li><code>'show_option_none'</code> &#8211; not available</li>
<li><code>'show_last_update'</code> &#8211; not available</li>
<li><code>'feed'</code> &#8211; not available</li>
<li><code>'feed_type'</code> &#8211; not available</li>
<li><code>'feed_image'</code> &#8211; not available</li>
<li><code>'current_category'</code> &#8211; not available</li>
<li><code>'taxonomy'</code> &#8211; not available</li>
<li><code>'title_li'</code> &#8211; not used</li>
<li><code>'echo'</code> – similar to wp_nav_menu(); true versus 1 as value</li>
<li><code>'depth'</code> – same as wp_nav_menu()</li>
<li><code>'walker'</code> &#8211; see below for additional notes</li>
</ul>
<p>Although there are great many options available to be used with <em>wp_list_categoires()</em> most are not used (as noted in the list above) in place of the user interface of <em>wp_nav_menu()</em> found under Appearance | Menu in the dashboard. The options that are marked as &#8220;not available&#8221; are currently not directly supported by <em>wp_nav_menu()</em> without the application of filters. The last few options remaining match up almost exactly with <em>wp_page_nav()</em> in a similar fashion as was shown with <em>wp_list_pages()</em>.</p>
<p>Just like the <em>wp_list_pages()</em> consideration, the <em>wp_nav_menu()</em> fallback_cb option may be set to <code>'fallback_cb' => 'wp_list_categories'</code>. This backward compatibility may also be addressed with a custom function as was noted, too.</p>
<p>Note: In most cases you would leave the <em>wp_nav_menu()</em> <code>'walker'</code> option set to its default <code>NULL</code> although <em>wp_list_categories()</em> uses its own default walker class.</p>
<div class="footnote">
<ol>Resources:</p>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/nav-menu-template.php">../wp-includes/nav-menu-template.php</a></li>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/category-template.php">../wp-includes/category-template.php</a></li>
<li><a href="http://codex.wordpress.org/Template_Tags/wp_list_categories">Template Tags/wp list categories</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/07/upgrade-wp_list_categories-to-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Upgrade wp_list_pages() to wp_nav_menu()</title>
		<link>http://wpfirstaid.com/2010/07/upgrade-wp_list_pages-to-wp_nav_menu/</link>
		<comments>http://wpfirstaid.com/2010/07/upgrade-wp_list_pages-to-wp_nav_menu/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 01:35:34 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_list_pages]]></category>
		<category><![CDATA[wp_nav_menu]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=584</guid>
		<description><![CDATA[A few options to address and with possibly a minor edit to the theme, you can upgrade wp_list_pages() easily to wp_nav_menu() in your theme.]]></description>
			<content:encoded><![CDATA[<p>Following in the series dealing with <a href="http://wpfirstaid.com/2010/07/upgrade-wp_page_menu-to-wp_nav_menu/">upgrading to the <em>wp_nav_menu()</em></a> function in <a href="http://wordpress.org">WordPress</a> 3.0 from menus derived from the template tags: <a href="http://codex.wordpress.org/Function_Reference/wp_page_menu"><em>wp_page_menu()</em></a>; <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages"><em>wp_list_pages()</em></a>; and, <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories"><em>wp_list_categories()</em></a>. This post will be covering the options involved in updating to <em>wp_nav_menu()</em> from <em>wp_list_pages()</em>.</p>
<p>Like the last post in the series we will look at the default arguments used by each function, starting with <em>wp_nav_menu()</em><sup> 1</sup>:</p>
<pre class="brush: php; title: ; notranslate">
wp_nav_menu( array(
    'menu'              =&gt; '',
    'container'         =&gt; 'div',
    'container_class'   =&gt; '',
    'container_id'      =&gt; '',
    'menu_class'        =&gt; 'menu',
    'menu_id'           =&gt; '',
    'echo'              =&gt; true,
    'fallback_cb'       =&gt; 'wp_page_menu',
    'before'            =&gt; '',
    'after'             =&gt; '',
    'link_before'       =&gt; '',
    'link_after'        =&gt; '',
    'depth'             =&gt; 0,
    'walker'            =&gt; '',
    'theme_location'    =&gt; ''
    ) );
</pre>
<p>The following is a default &#8220;menu&#8221; version of <em>wp_list_pages()</em><sup> 2, 3</sup>, often wrapped within a &lt;ul class=&#8221;menu&#8221;&gt; tag:</p>
<pre class="brush: php; title: ; notranslate">
&lt;ul class=&quot;menu&quot;&gt;
&lt;?php wp_list_pages( array(
    'sort_column'       =&gt; 'menu_order, post_title',
    'include'           =&gt; '',
    'exclude'           =&gt; '',
    'exclude_tree'      =&gt; '',
    'child_of'          =&gt; 0,
    'show_date'         =&gt; '',
    'date_format'       =&gt; get_option('date_format'),
    'title_li'          =&gt; __(''),
    /* 'title_li' set to '' for menus from the default 'Pages' */
    'authors'           =&gt; '',
    'echo'              =&gt; 1,
    'link_before'       =&gt; '',
    'link_after'        =&gt; '',
    'depth'             =&gt; 0,
    'walker'            =&gt; ''
    ) ); ?&gt;
&lt;/ul&gt;
</pre>
<p>Here is the break-down of the <em>wp_list_pages()</em> default options from above:</p>
<ul>
<li><code>'sort_column'</code> &#8211; not used</li>
<li><code>'include'</code> &#8211; not used</li>
<li><code>'exclude'</code> &#8211; not used</li>
<li><code>'exclude_tree'</code> &#8211; not used</li>
<li><code>'child_of'</code> &#8211; not used</li>
<li><code>'show_date'</code> &#8211; not used</li>
<li><code>'date_format'</code> &#8211; not used</li>
<li><code>'title_li'</code> &#8211; not used, see below for additional notes</li>
<li><code>'authors'</code> &#8211; not used</li>
<li><code>'echo'</code> &#8211; similar to wp_nav_menu(); true versus 1 as value</li>
<li><code>'link_before'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'link_after'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'depth'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'walker'</code> &#8211; same as wp_nav_menu()</li>
</ul>
<p>Similar to <em>wp_page_menu()</em>, the &#8216;sort_column&#8217;, &#8216;include&#8217;, &#8216;exclude&#8217;, &#8216;exclude_tree&#8217;, and &#8216;child_of&#8217; are replaced via the end-user&#8217;s specific choices. The &#8216;show_date&#8217; and its related &#8216;date_format&#8217; option, as well as the &#8216;author&#8217; argument, are not available within the default <em>wp_nav_menu()</em> structure. Once again, the balance of the default options in <em>wp_list_pages()</em> matches the defaults found in <em>wp_nav_menu()</em>.</p>
<p>Also consider setting the <em>wp_nav_menu()</em> fallback_cb option to <code>'fallback_cb' => 'wp_list_pages'</code>. This backward compatibility may also be addressed with a custom function as <a href="http://www.nkuttler.de/2010/06/08/wp_nav_menu-wordpress-3-0/">posted by Nicolas Kuttler</a>.</p>
<p>Note: If the <code>'title_li' => __('')</code> option was being used it may also require the removal of the wrapping &lt;ul&gt; tag in the existing menu structure created with <em>wp_list_pages()</em>.</p>
<div class="footnote">
<ol>Resources:</p>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/nav-menu-template.php">../wp-includes/nav-menu-template.php</a></li>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/post-template.php">../wp-includes/post-template.php</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">Function Reference/wp list pages</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/07/upgrade-wp_list_pages-to-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrade wp_page_menu() to wp_nav_menu()</title>
		<link>http://wpfirstaid.com/2010/07/upgrade-wp_page_menu-to-wp_nav_menu/</link>
		<comments>http://wpfirstaid.com/2010/07/upgrade-wp_page_menu-to-wp_nav_menu/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 23:46:26 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_nav_menu]]></category>
		<category><![CDATA[wp_page_menu]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=552</guid>
		<description><![CDATA[Upgrading from wp_page_menu() to wp_nav_menu() may be as easy as a simple find and replace operation.]]></description>
			<content:encoded><![CDATA[<p>WordPress version 3.0 has been live for a while and a lot of people want to make use of the <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu"><em>wp_nav_menu()</em></a> functionality but they are using one of the older template tags: <a href="http://codex.wordpress.org/Function_Reference/wp_page_menu"><em>wp_page_menu()</em></a>; <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages"><em>wp_list_pages()</em></a>; or, <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories"><em>wp_list_categories()</em></a>.</p>
<p>This post will be dealing with function arguments in common between <em>wp_nav_menu()</em> and <em>wp_page_menu()</em>. Follow-up posts will be covering <a href="http://wpfirstaid.com/2010/07/upgrade-wp_list_pages-to-wp_nav_menu/"><em>wp_list_pages()</em></a> and <a href="http://wpfirstaid.com/2010/07/upgrade-wp_list_categories-to-wp_nav_menu/"><em>wp_list_categories()</em></a>.  I will not be covering the specific use for each function&#8217;s arguments; the idea is to help show how these options correlate to one another.</p>
<p>Let&#8217;s start with the full default of <em>wp_nav_menu()</em><sup> 1</sup> explicitly displayed:</p>
<pre class="brush: php; title: ; notranslate">
wp_nav_menu( array(
    'menu'              =&gt; '',
    'container'         =&gt; 'div',
    'container_class'   =&gt; '',
    'container_id'      =&gt; '',
    'menu_class'        =&gt; 'menu',
    'menu_id'           =&gt; '',
    'echo'              =&gt; true,
    'fallback_cb'       =&gt; 'wp_page_menu',
    'before'            =&gt; '',
    'after'             =&gt; '',
    'link_before'       =&gt; '',
    'link_after'        =&gt; '',
    'depth'             =&gt; 0,
    'walker'            =&gt; '',
    'theme_location'    =&gt; ''
    ) );
</pre>
<p>Followed by the same explicit defaults of <em>wp_page_menu()</em><sup> 2, 3</sup>:</p>
<pre class="brush: php; title: ; notranslate">
wp_page_menu( array(
    'sort_column'       =&gt; 'menu_order, post_title',
    'include'           =&gt; '',
    'exclude'           =&gt; '',
    'show_home'         =&gt; false,
    'menu_class'        =&gt; 'menu',
    'echo'              =&gt; true,
    'link_before'       =&gt; '',
    'link_after'        =&gt; ''
    ) );
</pre>
<p>Now onto updating <em>wp_page_menu()</em> to <em>wp_nav_menu()</em>, which turns out to be rather simple.</p>
<p>Here is the break-down of the <em>wp_page_menu()</em> default options from above:</p>
<ul>
<li><code>'sort_column'</code> &#8211; not used</li>
<li><code>'include'</code> &#8211; not used</li>
<li><code>'exclude'</code> &#8211; not used</li>
<li><code>'show_home'</code> &#8211; not used (see bonus section below)</li>
<li><code>'menu_class'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'echo'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'link_before'</code> &#8211; same as wp_nav_menu()</li>
<li><code>'link_after'</code> &#8211; same as wp_nav_menu()</li>
</ul>
<p>First off &#8216;sort_column&#8217;, &#8216;include&#8217;, and &#8216;exclude&#8217; are replaced by the end-user&#8217;s choices using the <abbr title="User Interface">UI</abbr> of <em>wp_nav_menu()</em> found under Appearance | Menu in the dashboard. The balance of the default options are the same in <em>wp_nav_menu()</em>, with the exception of <code>'show_home' => false</code> which is the &#8220;bonus&#8221; content.</p>
<p>Upgrading from <em>wp_page_menu()</em> to <em>wp_nav_menu()</em> may be as easy as a simple find and replace operation.</p>
<div class="bonus">
<em>Bonus</em> &#8211; Although the default in <em>wp_page_menu()</em> does not show a home page link you can add a custom menu item in <em>wp_nav_menu()</em> if you want one to appear. You may need to edit your theme to remove the orginal &#8220;home&#8221; link if one was being generated before upgrading.
</div>
<div class="nota-bene">
NB: You may also need to add this line of code to your &#8216;functions.php&#8217; template file to add custom menu support to your theme: <code>add_theme_support( 'menus' );</code>
</div>
<div class="footnote">
<ol>Resources:</p>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/nav-menu-template.php">../wp-includes/nav-menu-template.php</a></li>
<li><a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/post-template.php">../wp-includes/post-template.php</a></li>
<li><a href="http://codex.wordpress.org/Function_Reference/wp_page_menu">Function Reference/wp page menu</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/07/upgrade-wp_page_menu-to-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Modified Post Function</title>
		<link>http://wpfirstaid.com/2010/03/modified-post-function/</link>
		<comments>http://wpfirstaid.com/2010/03/modified-post-function/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 19:14:33 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[get_the_date]]></category>
		<category><![CDATA[modified_post]]></category>
		<category><![CDATA[version_compare]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=494</guid>
		<description><![CDATA[A simple function to show who modified a post last and when in WordPress versions 3.0 and greater.]]></description>
			<content:encoded><![CDATA[<p>Here is a simple bit of code you can drop into your <strong>functions.php</strong> file then use in any of your templates where you want to display a short statement telling when a post was last modified.</p>
<pre class="brush: php; title: ; notranslate">
// Modified Post - requires WordPress version 3.0 or greater
function modified_post(){
  global $wp_version;
  if (version_compare($wp_version, &quot;2.999&quot;, &quot;&gt;&quot;)) {
    /* If the post date and the last modified date are different display modified post details */
    if ( get_the_date() &lt;&gt; get_the_modified_date() ) {
      echo '&lt;div class=&quot;modified-post&quot;&gt;'; /* CSS wrapper for modified post details */
      echo 'Last modified by ' . get_the_modified_author() . ' on ' . get_the_modified_date();
      echo '&lt;/div&gt;&lt;!-- .modified-post --&gt;';
    }
  }
}
</pre>
<p>Of course, you may have noticed the check for <a href="http://wordpress.org/download/nightly/">WordPress version 3.0 or greater</a>. This is required as the function <em><a href="http://phpdoc.wordpress.org/trunk/WordPress/Template/_wp-includes---general-template.php.html#functionget_the_date">get_the_date()</a></em> on line 6 is currently only found in versions of WordPress starting at 3.0</p>
<p>Once the above code has been added to your <strong>functions.php</strong> file <em>and</em> you are using a version of <em>WordPress greater than or equal to 3.0</em> then all you need to do is drop the following line of code inside <a href="http://codex.wordpress.org/The_Loop">the loop</a> of the template file you want to display the modified post details on.</p>
<pre class="brush: plain; light: true; title: ; notranslate">&lt;?php modified_post(); ?&gt;</pre>
<p>Also included is a CSS class element for easy styling. The code can be easily edited to add more elements, too.</p>
<p>Now, what good is this little bit of code? Have a look around and see it in action.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/03/modified-post-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 3.0 Navigation Menu Styles</title>
		<link>http://wpfirstaid.com/2010/03/wordpress-3-0-navigation-menu-styles/</link>
		<comments>http://wpfirstaid.com/2010/03/wordpress-3-0-navigation-menu-styles/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 14:19:05 +0000</pubDate>
		<dc:creator>The Doctor</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[register_sidebar]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_nav_menu]]></category>

		<guid isPermaLink="false">http://wpfirstaid.com/?p=418</guid>
		<description><![CDATA[A list of WordPress version 3.0 Navigation Menu default widget, and wp_nav_menu() function, generated CSS style elements.]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s jump right in &#8230;</p>
<p>Using the default definition from the <em><a href="http://codex.wordpress.org/Function_Reference/register_sidebar">register_sidebar()</a></em> function found in <em>../wp-includes/widgets.php</em> of WordPress version <del>3.0-alpha</del> 3.0-beta1<sup>2</sup> (see below):</p>
<pre class="brush: php; first-line: 551; title: ; notranslate">
	$defaults = array(
		'name' =&gt; sprintf(__('Sidebar %d'), $i ),
		'id' =&gt; &quot;sidebar-$i&quot;,
		'description' =&gt; '',
		'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
		'after_widget' =&gt; &quot;&lt;/li&gt;\n&quot;,
		'before_title' =&gt; '&lt;h2 class=&quot;widgettitle&quot;&gt;',
		'after_title' =&gt; &quot;&lt;/h2&gt;\n&quot;,
	);
</pre>
<p>&#8230; and the default Navigation Menu widget, the following CSS style elements are generated:</p>
<ul>
<li>#nav-menu-&lt;widget instance></li>
<li>.widget</li>
<li>.widget_nav_menu</li>
<li>.widgettitle</li>
</ul>
<p>&#8230; with these elements generated specifically by the <em><a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu()</a></em> function found in <em>../wp-includes/default-widgets.php</em> of WordPress version <del>3.0-alpha</del> 3.0-beta1<sup>2</sup>:</p>
<ul>
<li>.menu-&lt;menu name>-container<sup>2</sup></li>
<li>#menu-&lt;menu name></li>
<li>.menu</li>
<li>#menu-item-&lt;unique identifier*></li>
<li><del>.menu-item-type-&lt;types: page, category, Custom></del><sup>1</sup></li>
<li>.menu-item<sup>2</sup></li>
<li>.menu-item-type-&lt;post_type, custom, or taxonomy><sup>2</sup></li>
<li>.menu-item-object-&lt;page, or category><sup>2</sup></li>
<li>.current_page_item</li>
<li>.sub-menu<sup>1</sup></li>
</ul>
<p>This is just an initial listing of my observations as of the March 16, 2010 3.0-alpha version of WordPress. Look for future updates; and, please feel free to make note of your own observations below.</p>
<p><em>Bonus</em> &#8211; A suggested addition to style.css for theme developers:</p>
<pre class="brush: css; title: ; notranslate">
/* WordPress 3.0 Navigation Menu default widget */
.widget_nav_menu .menu {margin: 0;}
.widget_nav_menu .menu li {
  display: block;
  float: none;
  /* text-align: left; */
}
</pre>
<div class="nota-bene"><abbr title="Nota Bene">*N.B.</abbr> &#8211; each new menu item generates its own post ID in the WordPress database &#8216;posts&#8217; table. This appears to be in a similar fashion to post revisions.</div>
<div class="footnote">
<ol>Notes:</p>
<li>Mar 21, 2010
<ul>
<li>menu item type class further defined</li>
<li>sub-menu class noted</li>
</ul>
</li>
<li>Apr 15, 2010 (3.0-beta1 updates)
<ul>
<li>additional menu classes defined and/or modified</li>
<li>new menu container class noted</li>
</ul>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wpfirstaid.com/2010/03/wordpress-3-0-navigation-menu-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

