• hey, this is my first time trying to make my own theme.
    i tried making a navigation menu, but all i can do is list my pages/categories etc.
    i want to add a Home Page link in the menu before the categories, is it possible?
    so far i know there is an option to show a home page link only in “wp_page_menu” function.
    can i do the same, only with categories?

    tahnks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try it using the new perosnalised ‘menu’ under ‘Appearance’ in the Admin in WordPress 3.

    You can then have your navigation display categories

    Thread Starter avihai1

    (@avihai1)

    when i choose my theme i dont have this option.
    this is my header.php:

    <?php
    /**
     * The Header for our theme.
     *
     * Displays all of the <head> section and everything up till <div id="main">
     */
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
    	<title><?php bloginfo('name'); wp_title( '|', true, 'right' ); ?></title>
    	<link rel="profile" href="http://gmpg.org/xfn/11" />
    	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    	<?php
    		/* We add some JavaScript to pages with the comment form
    		 * to support sites with threaded comments (when in use).
    		 */
    		if ( is_singular() && get_option( 'thread_comments' ) )
    			wp_enqueue_script( 'comment-reply' );
    
    		/* Always have wp_head() just before the closing </head>
    		 * tag of your theme, or you will break many plugins, which
    		 * generally use this hook to add elements to <head> such
    		 * as styles, scripts, and meta tags.
    		 */
    		wp_head();
    	?>
    </head>
    
    <body>
    <div id="wrapper">
    	<div id="header">
    		<div id="logo">
    			<span><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"></a></span>
    		</div>
    	</div>
    	<?php
    	  wp_page_menu( array(
    		'sort_column'	=> 'menu_order, post_title',
    		'menu_class'	=> 'navigation',
    		'exclude'		=>	'2',
    		'echo'			=> true,
    		'show_home'		=> true)
    	);
    	//echo __("Home");
      ?>
    
    	<div id="main">

    can you explain how can i add this option?

    Thread Starter avihai1

    (@avihai1)

    ok, i added this code to functions.php:

    register_nav_menus( array(
    		'primary' => __( 'jhk', 'Dive-Indigo' ),
    	) );

    but how can i this menu display all categories automatically without me adding it manually?

    Are you using WordPress 3?

    You can add the following code in Header.php file which will show all the categories under your blog logo.

    <div id="navcontainer">
    					<?php
                        if(function_exists('wp_nav_menu')) {
                                wp_nav_menu( 'theme_location=menu_2&menu_id=nav&container=&fallback_cb=menu_2_default');
                            } else {
                                menu_2_default();
                            }
    
                            function menu_2_default()
                            {
                                ?>
                                <ul id="nav">
                                    <li <?php if(is_home()) { echo ' class="current-cat" '; } ?>><a href="<?php bloginfo('url'); ?>">Home</a></li>
            						<?php wp_list_categories('depth=3&exclude=1&hide_empty=0&orderby=name&show_count=0&use_desc_for_title=1&title_li='); ?>
            					</ul>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to add a Home page link to menu’ is closed to new replies.