• Resolved Jonas_

    (@jonas_)


    Hi people,

    for some reason my menu doesn’t show anymore…

    i havve this in functions.php

    register_nav_menus( array(
    		'primary' => __( 'Primary Navigation', 'top_navigation' ),
    		'secondary' => __( 'Secondary Navigation', '' ),
    		'tertiary' => __( 'Third Navigation', '' ),
    	) );

    header.php
    <?php wp_nav_menu( array( 'container_id' => 'catmenu','theme_location' => 'primary','fallback_cb'=> '' ) ); ?>

    and in my dashboard i have set in theme locations Primary Navigation top_navigation…

    So i have no idea why it isn’t working i don’t get any errors at all.

    I DIDN’T CHANGE ANYTHING TO THE MENUS LALTELY.. so im clueless

    What can be the problem?

    Thanks in advance

Viewing 10 replies - 1 through 10 (of 10 total)
  • Try looking in your server’s error logs.

    Thread Starter Jonas_

    (@jonas_)

    I’ve found the problem!

    add_filter( ‘pre_get_posts’, ‘my_get_posts’ );

    function my_get_posts( $query ) {
    if ( is_home() )
    $query->set( ‘post_type’, array( ‘post’, ‘new_release’ ) );

    return $query;
    }

    if i delete that it shows up.. if i add it my menu dissappears how do i fix that???

    Try moving the conditional & custom query to the appropriate theme template file.

    Thread Starter Jonas_

    (@jonas_)

    what you mean?

    The code i just posted is in functions.php too

    I’m suggesting you take it out of functions.php, get rid of add_filter and place the rest in the right template file.

    Thread Starter Jonas_

    (@jonas_)

    I have no idea in wich template file i have to post that..?

    Thread Starter Jonas_

    (@jonas_)

    I’ve read on a tutorial i need to add

    if ( $query->post_type == 'page' || $query->post_type == 'post' ) {

    it works fine, my menu shows now, but now my custom post type posts doesn’t show anymore… AND YES i tried to add $query->post_type = 'my_post_type' but without success..

    Anyone know the problem?

    Thread Starter Jonas_

    (@jonas_)

    Bump … still didn’t found a solution

    you could create a front-page.php if all you want to modify the loop is the front page. Then you can just modify the query directly on the page.

    Thread Starter Jonas_

    (@jonas_)

    Ok, lollll

    i just rewrote the post query in the index.php to

    <?php
    $args = array_merge( $wp_query->query, array( 'post_type' => 'my_post_type' ) );
    query_posts( $args );
    ?>

    and it simply works 😀

    Thanks anyways!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘My menu doesn't show anymore…’ is closed to new replies.