ThemeShaper Forums » Power Blog

[closed]

static pages and categories in the same header

(9 posts)
  1. Paul
    Member

    I'm building a portfolio site, with no CSS experience, and would like to know if there's any of getting static and category pages to run next to each other at the top of the page in the menu bar. For instance 'home' (static), 'portfolio' (category), 'blog' (category), about (static)?

    Posted 4 years ago #
  2. Add to your child theme functions.php:

    //  Add a dynamic menu using wp_list_pages
    
    function childtheme_menu() { ?>
         <div class="menu">
              <ul class="sf-menu">
                    <?php wp_list_pages('title_li='); ?>
    <li><a href="#">Static Page</a></li>
    <li><a href="http://www.mysite.com/category">Category Page</a></li>
              </ul>
         </div>
    <?php }
    
    add_action('wp_page_menu','childtheme_menu');

    See http://wptheming.com/2009/11/filter-menus-in-thematic/ for more reference.

    Posted 4 years ago #
  3. Paul
    Member

    Many thanks Devin, I'll give that a go.

    Posted 4 years ago #
  4. Paul
    Member

    I followed that tip and got this message back: Parse error: syntax error, unexpected '}' in /home/content/60/6070560/html/wp-content/themes/thematicpowerblog/functions.php on line 211

    Now I can't access wp-admin

    Posted 4 years ago #
  5. Hi Paul,

    The syntax of Devin's code is correct. There must be another issue at hand. Can you paste 15 lines of code from above and below line 211 here for me to take a look?

    -Gene

    Posted 4 years ago #
  6. you could also try: http://www.keighl.com/plugins/menus-plus/
    the last update fixed the only issue I was having with it. it will let you create a menu w/ pretty much anything.

    here is the code i used in one of my last themes. it checks to see if Menus+ is installed and then replaces your access with the default menus+ menu and defaults to the regular list_pages menu if it is not there:

    // Remove default Thematic access
    function remove_thematic_access() {
        remove_action('thematic_header','thematic_access',9);
    }	
    
    //Test if menuplus is installed
    if (function_exists('menusplus')) {
        add_action('init','remove_thematic_access'); //calls function to remove thematic access
    
    function childtheme_access() {
    //Then replace the access with a menu created by MenusPlus.  Use menu 1 for default site navigation!
      ?>
      <div id="access">
        <div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
    	<div class="menu menusplus">
    		<ul class="sf-menu">
    		<?php menusplus(1); ?>
    		</ul>
    	</div>
    
       </div><!-– #access -–>    
    
    <?php }
    
    	add_action('thematic_aboveheader','childtheme_access');  
    
    	} else {
    
    	//MenusPlus+ not installed. use default thematic_access which uses wp_list_pages()
    	add_action('init','remove_thematic_access'); //calls function to remove thematic access
    	add_action('thematic_aboveheader','thematic_access'); //moves thematic access to above branding
    
    	}
    Posted 4 years ago #
  7. Paul
    Member

    Hi em hr, Devin
    I overwrote the functions.php with the original from the download and got the site back to what it was like before.
    Below is the function code with Devin's code in it. I've swapped the mysite.com with the category

    The line is:

  8. multimedia
  9. But nothing happens.

    Like I say, I'm a novice. Any idea where I'm going wrong? Thank you both again.

    register_sidebar(array(
           	'name' => '3rd leader Aside',
           	'id' => '3rd-leader-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));  
    
        // Register the new widgets
        register_sidebar_widget('Thematic Power Blog Subscribe', 'thematic_power_blog_subscribe');
    
    }
    add_action( 'init', 'childtheme_widgets_init' );  
    
    ?>
    //  Add a dynamic menu using wp_list_pages
    
    function childtheme_menu() { ?>
         <div class="menu">
              <ul class="sf-menu">
                    <?php wp_list_pages('title_li='); ?>
    
    <li><a href="#">Static Page</a></li>
    <li><a href="http://www.paulmcmillanonline.com/category/multimedia/">multimedia</a></li>
         </div>
    <?php }
    
    add_action('wp_page_menu','childtheme_menu');
Posted 4 years ago #
  • em hr
    Moderator

    Remove the closing php tag the ?>

    from the line above this comment
    // Add a dynamic menu using wp_list_pages

    That should help some also try and use backticks or <code> markup when posting code in the forums it helps tremendously with readability. I have edited your last post affes\ct this change.

    -Gene

    Posted 4 years ago #
  • Paul
    Member

    Thanks Devin, Gene and Helga.

    Much appreciated.

    Posted 4 years ago #

  • RSS feed for this topic

    Topic Closed

    This topic has been closed to new replies.