• Resolved padrefra

    (@padrefra)


    I have events with plugin eventribe and I want to show events together with posts in home page – blog section – and in category query.

    Eventribe has the flag “put events in main query” but it does not work with hestia.

    So I create a plugin with a very simple function for hook pre_get_posts:

    function any_type_pre_get_posts( $query ) {
    if ( is_front_page() or is_category() ) {
    $query->set( ‘post_type’, any );
    }
    return $query;
    }

    It works, but main menu disappear! any help?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • irinelenache

    (@irinelenache)

    Hello @padrefra,

    Thank you for using Hestia!

    Can you please share some screenshots regarding how you added the custom code and the result? Besides this, it would be helpful to try and check if this is a plugin conflict, by disabling the other active plugins and see if the issue persists. You can do that by using Health Check plugin’s Troubleshoot mode, so the changes won’t be visible to the users.

    Looking forward to your reply,

    Irinel

    Thread Starter padrefra

    (@padrefra)

    Hallo,

    This is the normal front page big title section with main menu on top-right:

    I deactivate all plugins except eventTribe and mine that consists in only this lines:

    if ( is_front_page()  or is_category() ) {
        $query->set( 'post_type',  array( 'post', 'tribe_events' ) );
     }   
    return $query;

    Now in blog section I see correctly both posts and events, but here is the screenshot without main menu:

    Hi,

    You probably need to add ‘nav_menu_item’ to this list

    array( 'post', 'tribe_events' )

    Kind regards,

    Rodica

    Thread Starter padrefra

    (@padrefra)

    thank you, it works! But please, why it works if I write

    $query->set( ‘post_type’, array( ‘post’, ‘tribe_events’ ,‘nav_menu_item’?)

    but it not works if I write

    $query->set( ‘post_type’, any) ?

    thanks for your appreciate help

    Hi,

    I’m not exactly sure. I’ve noticed here someone else mentioned it not working https://wordpress.stackexchange.com/questions/92108/post-type-any-conundrum

    Regards,

    Rodica

    Thread Starter padrefra

    (@padrefra)

    Thanks, You are very kind I am greteful

    rodicaelena

    (@rodicaelena)

    Hi @padrefra,

    I’m glad I was able to help ??

    If you feel like, I would appreciate if you’d review our interaction here https://www.ads-software.com/support/theme/hestia/reviews/. It helps us a lot!

    Kind regards,

    Rodica

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom post type in front page erase main menu’ is closed to new replies.