Removing menus from users other than the administrator

If you want to exclude menu items by their labels: function hide_menu_items( $items ) { $items_to_exclude = [‘Menu Item 1’, ‘Menu Item 2’]; if ( !current_user_can( ‘manage_options’ ) ) foreach ($items as $key => $item) if ( in_array( $item->title, $items_to_exclude ) ) unset( $items[$key] ); return $items; } add_filter( ‘wp_get_nav_menu_items’, ‘hide_menu_items’, 20 );

Remove Spaces From WP_LINK_PAGES

Just replace a> <a with a><a: echo str_replace( ‘a> <a’, ‘a><a’, wp_link_pages( array ( ‘echo’ => FALSE ) ) ); If you want to remove the spaces around unlinked numbers too, I suggest a separate function in your theme’s functions.php to keep the code readable: function trimmed_link_pages( $args = array () ) { $args[‘echo’] = … Read more

Adding an Unlinked Space in a Custom Function

In my opinion CSS isn’t the right way, it should be a “real” space. Also there is no class to target the differents links in the string. Try this code: function wp_link_pages_args_prevnext_add($args) { global $page, $numpages, $more, $pagenow; if($page-1) # there is a previous page $args[‘before’] .= ‘ ‘. _wp_link_page($page-1) . $args[‘link_before’] . $args[‘previouspagelink’] . … Read more

Closing WP_LINK_PAGES DIV ID w/After Argmuent

First, declare the after arg at the beginning of your code: $args[‘before’] = ‘<div id=”link_wrap”>’; $args[‘after’] = ‘</div>’; When there is a next page, the arg is overwritten, so you’ll have to add the closing tag at the end: if ($page<$numpages) # there is a next page $args[‘after’] = ‘ ‘. _wp_link_page($page+1) . $args[‘link_before’] . … Read more

WP_LINK_PAGES Generating Unnecessary Tag

the </p> is just a browser artefact to compensate for a missing </span>; your code is missing . $args[‘link_after’] in two locations; the corrected code: // WP_LINK_PAGES: Add prev and next links to a numbered link list add_filter(‘wp_link_pages_args’, ‘wp_link_pages_args_prevnext_add’); function wp_link_pages_args_prevnext_add($args) { global $page, $numpages, $more, $pagenow; $args[‘before’] = ‘<div id=”link_wrap”>’; $args[‘after’] = ‘</div>’; $args[‘link_before’] … Read more