How to add schema.org SiteNavigationElement and property URL to navbar?

A little searching got me the nav_menu_link_attributes filter: function wpse183311_filter( $atts, $item, $args ) { $atts[‘itemtype’] = ‘http://schema.org/SiteNavigationElement’; return $atts; } add_filter(‘nav_menu_link_attributes’, ‘wpse183311_filter’, 3, 10); Add however many attributes you need to the $atts array as necessary

Missunderstanding of WordPress menus

I guess you mean the wp_page_menu fallback, where you can use the filters wp_page_menu_args and wp_page_menu to modify it’s output. Notice that this function is a wrapper for the wp_list_pages() function, that ships with the wp_list_pages_excludes and the wp_list_pages filters. That function is again wrapper for the walk_page_tree() function, that activates the Walker_Page class walker … Read more

Hide menu from homepage

You should be able to short circuit the menu by conditionally returning an empty string by adding this code to your theme functions.php : add_filter( ‘pre_wp_nav_menu’, ‘wpse_210095’); function wpse_210095($menu) { if (is_home()) { $menu = ”; } return $menu; } You can see in the Core where this logic executes: 260 $nav_menu = apply_filters( ‘pre_wp_nav_menu’, … Read more

How does the ‘the_post_navigation()’ work for CPT’s?

‘the_post_navigation’. It seems to work for Custom Post Types (CPTs) but I cannot figure out how it does this. the_post_navigation() uses get_the_post_navigation() which uses get_previous_post_link() and get_next_post_link() which both uses get_adjacent_post_link() which uses get_adjacent_post() to get the next and previous post from the same post type. If we look at the source code for get_adjacent_post(), … Read more

How can i automatically add CPT single pages as sub menu items

This should work: add_filter( ‘wp_get_nav_menu_items’, ‘cpt_locations_filter’, 10, 3 ); function cpt_locations_filter( $items, $menu, $args ) { $child_items = array(); $menu_order = count($items); $parent_item_id = 0; foreach ( $items as $item ) { if ( in_array(‘locations-menu’, $item->classes) ){ //add this class to your menu item $parent_item_id = $item->ID; } } if($parent_item_id > 0){ foreach ( get_posts( … Read more

Restrict the_post-navigation to same category?

Customize your posts navigation to get posts in the same tag. the_post_navigation( array( ‘prev_text’ => __( ‘prev chapter: %title’ ), ‘next_text’ => __( ‘next chapter: %title’ ), ‘in_same_term’ => true, ‘taxonomy’ => __( ‘post_tag’ ), ‘screen_reader_text’ => __( ‘Continue Reading’ ), ) ); Source

How to create a menu with pages and post categories?

Use a Navigation Menu. In your child theme or custom theme’s functions.php file, create the menu like so: add_action(‘after_setup_theme’, ‘wpse_add_theme_support’); function wpse_add_theme_support() { add_theme_support(‘menus’); } add_action(‘init’, ‘wpse_nav_menus’); function wpse_nav_menus() { register_nav_menu( ‘primary-menu’, __( ‘Primary Menu’, ‘theme-slug’ ) ); } Then presumably in header.php, or wherever you’re adding the menu: wp_nav_menu(array(‘theme_location’ => ‘primary-menu’); There are various … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)