Site logo

Archived topic

Primary navigation does not display on desktop

12 replies · Started by Carsten on September 19, 2021

Viewing posts 1–13 of 13

Hi there, my primary navigation does not display on desktop, but on mobile only.
I have deactivated elements and custom code, but no luck.

Any idea, why the navigation does not display on desktop?

Thanks!

Hi there,

What if you disable GP Premium?

Let me know :)

I have tried, but with same result. GP Premium is deactivated now.

GP Premium is deactivated now.

I hard cleared my browser cache and used incognito mode but still seeing the mobile header and off cavnas navigation which are both premium options.

I assume this is a caching issue. Can you confirm?

Hi again, I activated the GP main theme the navigation is back.

Then I activated my child theme again, and the navigation is now displayed again. No settings has changed.

I have some elements in my functions.php and I suspect it is the order in which the GP Premium/child theme is activated which is causing this.

Can you with a quick look see if any of these functions could cause this?

Thanks!

//GeneratePress kode, sikrer at footer layout element fungerer med BuddyPress

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
    if ( 32836 === $element_id && is_buddypress() ) {
        $display = true;
    }

    return $display;
}, 10, 2 );

add_action( 'wp_enqueue_scripts', 'generate_dequeue_secondary_nav_mobile', 999 );
function generate_dequeue_secondary_nav_mobile() {
    wp_dequeue_style( 'generate-secondary-nav-mobile' );
}
 
 

 //GeneratePress kode, sikrer at Block Element virker på Activity page

/*add_filter( 'generate_block_element_display', function( $display, $element_id ) {
    if ( 42208 === $element_id ) {
        if ( function_exists( 'bp_is_activity_component' ) && bp_is_activity_component() ) {
            return true;
        }
    }

    return $display;
}, 10, 2 );*/

 //GeneratePress kode, sikrer at Layout Element virker på Register page

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
    if ( 47823 === $element_id ) {
        if ( function_exists( 'bp_is_register_page' ) && bp_is_register_page() ) {
            return true;
        }
    }

    return $display;
}, 10, 2 );

 //GeneratePress kode, sikrer at PayPal Element Display Rules virker på Register page

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
    if ( 54288 === $element_id ) {
        if ( function_exists( 'bp_is_register_page' ) && bp_is_register_page() ) {
            return true;
        }
    }

    return $display;
}, 10, 2 );

//Mobil Header Menu 

//GeneratePress element 45256, edit, avatar, cover image 

add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
    if ( 45256 === $element_id && bp_is_user_profile_edit() ) {
        $display = true;
    }

    return $display;
}, 10, 2 );

//GeneratePress element 43720, search, messages, visitors, edit profile 

add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
    if ( 43720 === $element_id && bp_is_user_profile_edit()) {
        $display = false;
    }

    return $display;
}, 10, 2 );

add_filter( 'generate_hook_element_display', function ( $display, $element_id ) {

	if ( 45256 != $element_id ) {
		return $display;
	}

	// If message component or setting set display to false.
	if ( bp_is_messages_component() || bp_is_settings_component() ) {
		$display = false;
	}

	return $display;
}, 10, 2 );

I suspect it is the order in which the GP Premium/child theme is activated which is causing this.

That can't be the case as it doesn't matter.

Almost all the functions are attached to an element so I can't tell without seeing the actual element.

Try removing each one to identify the cause.

Much of the code is added of necessity because the elements do not work without it, like the display rules for the sidebars on the register page and other pages. I would rather not use this code and hope you would look into this bug.

The fact is that navigation is displaying now, even though nothing have been changed, other than GP Premium has been deactivated and activated again and theme has been changed to main theme and back to child theme again.

I have also experienced that the page goes down if I have certain elements activated, and the GP Premium is deactivated,so the order of activation does matter in some cases in my experience.

This cannot be a bug in GP - otherwise it would happen all the time and not just sometimes as the code is static.

The order of activation absolutely does not matter - I've been doing this for a very long time ;)

It sounds somewhat like a caching issue to me.

I hear what you are saying ;-)

I have got the code for the not working elements from GP.

Regarding the missing navigation, then I can't explain what has changed since it is working now.
It has been an issue for a long time in different browsers and with browser cache cleared, so it can hardly be a cache issue.

But the important thing is that it is working now.

Thanks!

Update, the navigation does not work anyway, so the issue must be with the element code added.

What do you mean it "does not work"?

I no longer see the link to your site as it's erased when the topic is marked as resolved.

Hi there, what I mean is that the issue is not solved, the primary navigation is still not displayed on desktop, as first believed.

All functions custom code have been deactivated with same result.

Thanks

This is really starting to sound more and more like a caching issue.

When you mentioned before that it was working when everything was activated, I believe what you were actually seeing is the setup without everything being activated.

Same thing as I mentioned here:
https://generatepress.com/forums/topic/primary-navigation-does-not-display-on-desktop/#post-1935926

All functions custom code have been deactivated with same result.

And now you are actually seeing the result of everything being activated as the cache hasn't been cleared yet.

With everything deactivated right now, can you try making a change (any change) in the customizer and see if it reflects on the live site right away?

This archived topic is closed to new replies.