ThemeShaper Forums » Thematic

Changing dynamic Home page posistion

(3 posts)
  • Started 10 years ago by ndrwld
  • Latest reply from ndrwld
  • This topic is resolved

Tags:

  1. ndrwld
    Member

    I'm trying to create my own child theme. And I have the second question:
    Is it possible to change dynamic "Home" page position in menu.
    For example from:
    Home|About|Contact|
    to
    About|Home|Contact|
    * "About" and "Contact" pages are static.
    To show Home page in my template I use sample-thematic-child code:
    function childtheme_menu_args($args) {
    $args = array(
    'show_home' => 'Start',
    'sort_column' => 'menu_order',
    'menu_class' => 'menu',
    'echo' => true
    );
    return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    I would really appreciate for Your Help.
    Matew

    Posted 10 years ago #
  2. Hey Matew,

    I tested a couple of easy things and dropped all of them 'cause none of them kept the markup for the menu.

    The only way to keep the markup especially the current_page_item is to add the following code to your child theme's functions.php:

    // First we remove the standard menu
    function remove_stuff() {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_stuff');
    
    // and now we create our own
    function childtheme_access() { ?>
        	<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>
                <?php
                    // This is our first menu item:
                    wp_page_menu('sort_column=menu_order&include=332');
                    // This will display only 'home'
                    wp_page_menu('show_home=1&include=9999');
                    // and now comes the rest:
                    wp_page_menu('sort_column=menu_order&include=413'); ?>
            </div><!-- #access -->
    <?php }
    // adding our menu to Thematic
    add_action('thematic_header','childtheme_access',9);

    Keep in mind that you need to change the page IDs according to your needs.

    This code snippet is tested and approved.

    Cheers,

    Chris

    Posted 10 years ago #
  3. ndrwld
    Member

    Chris You're the Great! I saw a lot of your code snippet's, thank You for all of them.
    I'm really appreciative for your help. Everything works fine.

    *For other's: I've confused WP Page order in wordpress backend with Page ID :) Notice that for Page ID you must look in your database.

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.