Tag Info

New answers tagged

1

You are not providing the correct parameter to wp_get_nav_menu_object() function. It needs the menu ID or menu slug but you are providing the menu theme location. Obviously, I can not tell you what is the ID or slug of your menu. One way of getting the menu ID of the menu assigned to theme location is using get_nav_menu_locations(): $menu = ...


0

Figured it out :) It ends up the Smarter Navigation plugin has a few other functions that I missed: https://plugins.trac.wordpress.org/browser/smarter-navigation/trunk/template-tags.php I used get_adjacent_id_smart() like so: <?php $prev_post = get_adjacent_id_smart(true); if(!empty($prev_post)): echo 'not empty'; ...


0

Try to following way-- <?php $prv_post = get_previous_post(); $next_post = get_next_post(); ?> <?php if(!empty($prv_post)) { ?> <a href="<?php echo get_permalink($prv_post->ID ); ?>" class="prev" rel="prev"> <span class="meta-nav"><?php _e('Previous Post', 'awe') ?></span> <span class="nav-icon"><i ...


0

I figured it out, after trying a million things I tried one more, super stupid but it worked, I just went to permalink settings, clicked save changes and my posts and pages are working again... I don't understand why but finally it's working again.


0

Please check with other themes also. If it is a problem with the current active theme, rectify it at the theme level. First activate a default theme provided by WordPress. If it is working fine, then the issue is with your theme.


0

The solution I've wanted looks like this: <?php // Allow HTML descriptions in WordPress Menu remove_filter( 'nav_menu_description', 'strip_tags' ); function my_plugin_wp_setup_nav_menu_item( $menu_item ) { if ( isset( $menu_item->post_type ) && 'nav_menu_item' == $menu_item->post_type) { $menu_item->description = ...


-2

add_filter( 'wp_nav_menu_items', 'add_sidebar_output_to_menu998722', 10, 2 ); function add_sidebar_output_to_menu998722( $items, $args ) { if ($args->theme_location == 'nav-location') { $items .= dynamic_sidebar($sidebar['id']); } }


0

might it can help you for your query : Basically I need a way to display widgets in menu, without using any extra plugins. place the code in your theme’s functions.php <?php register_sidebar( array( 'name' => 'Page Menu', 'id' => 'page-menu', 'before_widget' => '<div id="page-nav">', 'after_widget' => ...


1

As recommended in a similar post: http://wordpress.stackexchange.com/a/156494/74343 1.) Create the menus as you want them, and name them as you like, as an example "mobile-menu" and "desktop-menu". 2.) In your child theme in the header.php you could switch according to the wp_is_mobile() flag like this: if ( wp_is_mobile() ) { wp_nav_menu( array( ...



Top 50 recent answers are included