Support » Fixing WordPress » Static page in header-menu

  • Hello there!

    I have a problem:

    when I add a category to wordpress, I would love for it to be a ‘static page’ that appears in the headermenu (tabs), without there being any posts on it.

    At the moment, when I make a category, it appears in the right side bar, but not as a tab (I am using the shade pro theme: http://ericulous.com/2008/09/16/wp-theme-shade-pro/).

    The reason I want this, is because I want to add a page like: ‘contact’ and ‘about’ without posting a post there, but just html-ing a fixed content!

    Who can help me?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can add a static page from within WordPress, which will, usually, automatically add a link to the headermenu.

    Thread Starter dekraan

    (@dekraan)

    Hello …paul. Can you explain to me how and where it’s done?

    Is it at: theme editor? pages edit? posts edit? for example?

    I can create a page from ‘pages’ and then ‘edit’ or ‘add new’, but these pages only appear in the rightbar under pages. And not in the headermenu. Unless I put a post in it, but I want to avoid doing that 🙂

    It sounds as though you’re creating them in the right way — under the “Pages” menu (Edit or Add New). And I’ve just tried a test page with no content whatsoever on my test installation, and that created the top menu item. Which leads me to think it might be something in the way your theme is set up — looking for content before adding the page. But what that might be is beyond my capabilities; hopefully one of those who understands the various themes more than me will come along and see this post soon. Sorry, by me trying to help, it may have meant that someone else hasn’t.

    Thread Starter dekraan

    (@dekraan)

    Thats ok 🙂 pherhaps someone else will see it as well. All help or attempts to are very appreciated! My first thought was also that it would be as simple as adding a page, but alass it needs a post to show up in my theme, I think you are right about that!

    Maybe some code will give anyone looking the right idea. This is the headercode that produces the menu, I think. It is on the home.php and header.php page! Maybe the ‘categories to exclude’ has something to do with it. The first part is the logo (i guess), and then something about the printcatslist (unknown to me):

    <?php
    		// Category Sort options
    		global $categories_sort;
    		if(get_settings('Shade_sortcategories')!='')
    		{
    			$categories_sort = 'sort_column='. get_settings('Shade_sortcategories');
    		}
    
    		// Exclude Categories options
    		global $categories_to_exclude;
    
    		if(get_settings('Shade_excludecategories')!='')
    		{
    			$categories_to_exclude = 'exclude='. get_settings('Shade_excludecategories');
    		}
    		?>
    		<?php wp_head(); ?>
    	</head>
    	<body>
    		<div id="header">
    			<div class="header">
    				<a href="<?php echo get_option('home'); ?>/"><img src="<?php echo get_option('home'); ?>/wp-content/themes/Shade/img/logo.gif" alt="Logo" /></a>
    				<ul>
    					<?php
    					require_once( 'wp-content/plugins/printcatslist.php' );
    					KFPrintCategories( $categories_to_exclude, false );
    					?>
    				</ul>
    			</div>
    		</div>

    And in the printcatslist.php it says:

    <?php
    /*
    Plugin Name: Category Highlight
    Plugin URI: http://www.karlforshaw.co.uk
    Description: Highlights the category your currently viewing in the top navigation. <b>Note:<b> Only works in (ver: 2.1+)
    Author: Karl Forshaw
    Author URI: http://www.karlforshaw.co.uk
    
    Modifications: Ryan Maffit
    Modifier URL: http://www.ryanmaffit.com/
    */
    
    	function KFPrintCategories( $categories_to_exclude ) {
    
    		// Check args
    		if (empty( $categories_to_exclude )) {
    			$arg_string = 'orderby=name';
    		}
    		else {
    			$arg_string = 'orderby=name&exclude=' . $categories_to_exclude;
    		}
    
    		// Get the category list
    		$categories = get_categories( $arg_string );
    
    		// Get the current category
    		global $wp_query;
    		$current_category = $wp_query->get_queried_object_id();
    
    		echo "<li".(is_home() ? " class=\"active\"" : "")."><a href=\"".get_bloginfo('siteurl')."\"><span>Home</span></a></li>";
    
    		// Echo the output
    		foreach ($categories as $cat) {
    
    			echo "	<li class=\""; 
    
    			if (is_home()) {
    				// Do Nothing
    			}
    			elseif ((! empty( $current_category )) && ($current_category == $cat->term_id)) {
    				echo ' active';
    			}
    			elseif ( in_category( $cat->term_id ) ) {
    				echo ' active';
    			}
    
    				echo "\">
    						<a title=\"View all posts filed under {$cat->name}\" href=\"" . get_category_link( $cat->term_id ) . "\"><span>{$cat->name}</span></a>
    				</li>";
    		}
    		// Done.. phew!
    	}
    
    ?>

    Hopefully this could point someone in the right direction!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Static page in header-menu’ is closed to new replies.