ThemeShaper Forums » Thematic

[closed]

aboveheader() menu best practices

(7 posts)
  • Started 3 years ago by Biofobico
  • Latest reply from Chris
  • This topic is not resolved
  1. Biofobico
    Member

    I want a menu above the header of my design. Since im a noob at wordpress and php, i would like to know what are the best practices to achieve this.
    So my stuff in functions.php:

    function childtheme_menu_above_header() { ?>
    
       <div id="menu-above-header">
       <ul>
       <?php wp_page_menu( array( 'show_home' => 'home', 'sort_column' => 'menu_order' ) ); ?>
    </ul>
       </div>
    
    <?php }
    add_action('thematic_aboveheader','childtheme_menu_above_header');

    The problem with this, is that the menu will have the style of the <ul class="sf-menu sf-js-enabled"> even with the <div id="menu-above-header"> styled differently.

    I don't know if im doing the right way by putting that code in functions.php or not , so any suggestions are welcome.

    thanks in advance and sorry for my english.

    Posted 3 years ago #
  2. Try just adding this to your functions.php file:

    function remove_thematic_actions() {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_actions');
    
    add_action('thematic_before','thematic_access', 1);
    Posted 3 years ago #
  3. Biofobico
    Member

    Crap!! Now my layout is broken... Guess the removing actions should be the first think to do when trying to accomplish some layouts.

    Anyway, thanks for the help Devin :)

    Posted 3 years ago #
  4. Biofobico
    Member

    So let me understand this point. Say i already have the site ready for deliver and the client, (like usual) decides to have a navigation (or any other element) on the top of the design. Will that means that my layout will fall apart completely because some styles will be automatically applied like in my first post? I ask this because sometimes even with good planning there are issues that will arise prior to the deliver of the project. I'm not working in a real project here, just trying to learn Thematic and Wordpress before i dive in a real thing.

    Posted 3 years ago #
  5. Hi Biofobico-

    Maybe this will clarify things a bit. Out of the box, Thematic is a functional theme with a solid choice of layouts.

    When you start customizing your child theme using PHP ( action hooks and filters either removing, replacing, or adding things ) then you are in effect changing the html markup to some degree either large or small. Once the markup has changed, the CSS will need to be adjusted to suit the changes in html.

    -Gene

    Posted 3 years ago #
  6. Biofobico
    Member

    Thanks for the reply Gene.
    The thing that's driving me hairless, is how and why thematic adds certain classes. Take a look please:

    function childtheme_menu_above_header() { ?>
       <div id="menu-above-header">
       <ul>
       <?php wp_page_menu( array( 'show_home' => 'home', 'sort_column' => 'menu_order' ) ); ?>
       </ul>
       </div>
    <?php }
    add_action('thematic_aboveheader','childtheme_menu_above_header');

    What i don't get it it's why a <div class="menu"> is on my html?

    <div id="menu-above-header">
     <ul>
      <div class="menu">
       <ul class="sf-menu sf-js-enabled">
        <li class="current_page_item"><a title="home" href="http://localhost:8888/teste">home</a></li>
        <li class="page_item page-item-2"><a title="About" href="http://localhost:8888/teste/about/">About</a></li>
        <li class="page_item page-item-3"><a title="Services" href="http://localhost:8888/teste/services/">Services</a></li>
        <li class="page_item page-item-5"><a title="Products" href="http://localhost:8888/teste/products/">Products</a></li>
        <li class="page_item page-item-6"><a title="Location" href="http://localhost:8888/teste/location/">Location</a></li>
        <li class="page_item page-item-7"><a title="Contact" href="http://localhost:8888/teste/contact/">Contact</a></li>
      </ul>
     </div>
    </ul>
    </div>

    I assume it has something to do with wp_page_menu in my functions.php file. But not sure about it since im a complete noob at php and wordpress.
    Any thoughts about how to "bypass" this "issue"? Because i cant apply any css to a menu without chaging the other one to.
    Maybe im being a dumbass here, but i really like to know how to do stuff and understand why im doing it.

    Thanks for your patience.

    Posted 3 years ago #
  7. It is the default setting for menu_class -> wp_page_menu

    Chris

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.