Hi rgbcraft,
thanks for your response. You could look at the is_sticky() function in WordPress (http://codex.wordpress.org/Function_Reference/is_sticky)
I haven’t tried it, but in the foreach loop that iterates over the posts, on the first line inside the loop you could try:
if (is_sticky(post->ID)) { continue; }
Again, I haven’t tried it, but something like this might work. I’ll think about adding support for your request in a way that doesn’t clutter the user interface. I don’t want to add too many checkboxes and stuff, I hope you’ll understand.
Kind regards,
Diana
I may have the wrong place, but I tried your suggestion and the menu disappeared altogether.
/*
* Build the menu structure for display: Augment taxonomies (category, tags or custom taxonomies) that have been marked as such, by their posts. Optionally: remove original menu item.
*/
function cpcm_replace_taxonomy_by_posts( $sorted_menu_items, $args ) {
$result = array();
$inc = 0;
foreach ( (array) $sorted_menu_items as $key => $menu_item ) {
if ( is_sticky()) {continue ;}
// Augment taxonomy object with a list of its posts: Append posts to $result
// Optional: Remove the taxonomy object/original menu item itself.
Hi rgbcraft,
1. That’s not the foreach loop that iterates over the posts
2. You haven’t copied the line I gave you properly
Haven’t got the time to copy the exact code for you right now, I’ll check back in later.
Kind regards,
Diana
Hi rgbcraft,
I’ve applied the fix I proposed myself. Firstly, I apologize for omitting the dollar sign in the $post variable.
Here’s what you should do. Find the line foreach( (array) $posts as $pkey => $post ) {
Right beneath that, but above the comment // Decorate the posts ..., add the line if (is_sticky($post->ID)) { continue; }
The result should be:
foreach( (array) $posts as $pkey => $post ) {
if (is_sticky($post->ID)) { continue; }
// Decorate the posts with the required data for a menu-item.
$post = wp_setup_nav_menu_item( $post );
I may add some support for stickies later, but not right now.