Problem excluding category from get_next_post
Did you try with: get_adjacent_post ? get_adjacent_post(false, ‘YourID’, false); wp topic: get_adjacent_posts-exclude-category-syntax
Did you try with: get_adjacent_post ? get_adjacent_post(false, ‘YourID’, false); wp topic: get_adjacent_posts-exclude-category-syntax
You mention a custom post type, are you also using a custom taxonomy? If so you need to specify this taxonomy in your function call: the_post_navigation(array( ‘prev_text’=>__(‘previous project: %title’), ‘next_text’=>__(‘next project: %title’), ‘in_same_term’ => true, ‘taxonomy’ => ‘wpse240053_custom_taxonomy_name’, )); By default the built-in category taxonomy for Posts is used. This requires WP4.4 or later.
Let’s take a look at wp_get_nav_menu_items code reference. It takes two parameters: $menu – (int|string|WP_Term) (Required) Menu ID, slug, name, or object, $args – (array) (Optional) Arguments to pass to get_posts(). So we can use get_posts args in here… And if we want to get only top-level posts, then post_parent arg comes useful… So something … Read more
You have to edit the files in: wordpress/wp-content/themes/twentyseventeen/template-parts/navigation/navigation-top.php and then create a custom walker, try to take a look here. Try in this way: <?php /** * Displays top navigation * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.2 */ ?> <div class=”container”> <nav class=”navbar navbar-expand-lg navbar-light” id=”mainNav”> <a class=”navbar-brand js-scroll-trigger” … Read more
The filter you need is nav_menu_css_classes. You should be able to test for *in_category* on single post and archive pages, and add the appropriate class there.
One of my favorite ways to do this is to use the Factious plugin. It is still fairly basic and only has a Sidebar widget by default. However, it has an extenable API(ish thing) that lets you write code to place it elsewhere. The reasons why I like it are this: Written by people who … Read more
You don’t need a custom walker function. You can alter wp_nav_menu like this: wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘flexnav’, //Adding the class for FlexNav ‘items_wrap’ => ‘<ul data-breakpoint=”800″ id=”%1$s” class=”%2$s”>%3$s</ul>’, // Adding data-breakpoint for FlexNav )); and proper script init should be: jQuery(document).ready(function($){ $(“.flexnav”).flexNav({ }); }); Drop menu button somewhere outside navigation: <div … Read more
Put this pretty much anywhere (ie. functions.php) add_theme_support( ‘menus’ );
We can add custom nav menu classes through the nav_menu_css_class filter. Example: The following should add the CSS class wpse-object-id-{object_id} to the <li> tags: // Add filter add_filter( ‘nav_menu_css_class’, ‘wpse_menu_item_id_class’, 10, 2 ); // Your navigational menu wp_nav_menu( $args ); // Remove filter remove_filter( ‘nav_menu_css_class’, ‘wpse_menu_item_id_class’, 10, 2 ); where we define the filter callback … Read more
idk about working it back into your breadcrumbs… which by nature i think are hierarchical. but this should give you a list of the pages that have the same parent as the page you are on (aka its siblings) albeit in a totally unstyled way global $post; $args = array(‘child_of’ => $post->post_parent, ‘exclude’=> $post->ID); if … Read more