Automatically remove trashed pages from nav menu
Just hook the default delete_post handler for menus onto the trash action too: add_action( ‘wp_trash_post’, ‘_wp_delete_post_menu_item’ ); How simple is that!
Just hook the default delete_post handler for menus onto the trash action too: add_action( ‘wp_trash_post’, ‘_wp_delete_post_menu_item’ ); How simple is that!
I had a similar problem and here is the best solution I could come up with. The reason (I think) that private or non-published items show up in menus is that the menu items are themselves posts and have their own post_status. That means that in a situation where a page is marked private, the … Read more
The problem was ultimately with the WordPress Importer plugin. I could hack at it (and have suggested an improvement to the developers) but I am going to got around this by writing a custom Importer of my own. It isn’t the most convenient (to re-upload the .XML file) but in cases where users have complex … Read more
I was searching for an answer for this but suddenly I got the idea and it works! In the menu settings just add the anchor link just like an html link code <a href=”#anchor” >titulo </a> So with WP is the same but only adding the anchor in the field link This will create the … Read more
You could maybe choose to use a tree like that: Fruits Color1 Apple Watermelon Color2 Banana Lemon Level1 Level2 Level3 This way, you can, in your theme, hide the second level. Hope that helps.
I adjusted your code a little bit to integrate the wp_query() class instead of query posts(), which is only meant for altering the main loop. You should always opt to use wp_query() when trying to create secondary loops. Since we’re using wp_query(), we’re also going to have to use wp_reset_postdata() instead of wp_reset_query. Im not … Read more
Yes, I could set the menu structure, but I don’t know if the user would make this, when he creates a new page. The difference is here because I needed the hierarchy for some special adaptions I made (read the content from certain sub pages and so on …). Normally, the menu should define the … Read more
As a purely theory example, this is how I would approach the problem: $cats = get_categories(); echo ‘<ul>’; foreach($cats as $cat) { echo'<li>’.$cat->name; if($cat->parent != 0) { $subcats = get_category(‘child_of=”.$cat->cat_ID; echo “<ul>’; foreach($subcats as $subcat){ echo ‘<li>’.$subcat->name.'</li>’; } } echo ‘</li>’; } echo ‘</ul>’; I don’t expect that to work fully as I coded it … Read more
Well, I’m afraid I never did work out the code to this. What I did find is a pair of plugins that accomplish what I’m looking to do. List sub pages of the same level as the current sub page/child/grandchild page and then be able to exclude certain pages from showing up. http://wordpress.org/extend/plugins/child-page-navigation/ http://wordpress.org/extend/plugins/exclude-pages/ Might … Read more
This is what i have used for checking to see if the custom field is there or not. I am sure you can use it as well. <?php $custom_field = get_post_meta($post->ID, ‘Your Custom Field Name’, true); // Checks to see if there is a value in the custom field if($custom_field != ”) { echo $custom_field; … Read more