Sticky posts need to be first in mega menu but newest posts appera instead

Posted in: Newspaper
Post count: 46

Hello. As my title suggests, I need sticky posts to appear first in respective categories in the mega menu but newest posts are appearing first.
How can I get the same post to appear first?

Thanks

Post count: 35449

Hi,

Unfortunately out theme do not have this option for sticky posts in mega menu, also sticky post is not working with our theme,sorry.
Sorry for the inconvenience.

Thank you for your understanding.

Post count: 46

Is there any other way to force a specific post to always be first?

Post count: 35449

Hi,

Unfortunately mega menu is set to sort after latest post, maybe only if you make some changes in theme file, but you’ll need to make that changes after each updates.
Sorry.

Thank you for your understanding.

Post count: 46

Thanks for the reply.

What would I need to change in what file. I’m willing to take a look.

Thanks very much in advance.

Post count: 22421

Hello,

Sorry but we have not tested sticky posts with any of our theme blocks so we cannot provide a solution in this regard. you will need to hire a freelancer to help out with the code needed as we cannot offer any customization services at the moment.

Thank you!

Post count: 46

OK. It would be good to have this feature in your theme.

However, I had an idea for a workaround, which was to set the date of the ‘sticky’ post to a date a long time in the future so it’s always the newest.
However, by default, wordpress then makes this a scheduled post.

So, I found this piece of code to over-ride that and publish it now:

//make future post date visible now
function onetarek_prevent_future_type( $post_data ) {
if ( $post_data['post_status'] == 'future' && $post_data['post_type'] == 'post' )#Here I am checking post_type='post' , you may use different post type and if you want it for all post type then remove "&& $post_data['post_type'] == 'post'"
{
$post_data['post_status'] = 'publish';
}
return $post_data;
}
add_filter('wp_insert_post_data', 'onetarek_prevent_future_type');
remove_action('future_post', '_future_post_hook');

This does what I need it to. Thanks all the same

  • This reply was modified 7 years by 3ftDeep.
Post count: 35449

Hi,

We are glad that you find a solution for your problem.

Thank you for your massage.

Post count: 46

Just as a follow up on this, if anyone else wants to do the same thing:

To ‘fake’ a sticky post in the mega menu (make specific posts always appear first in the mega menu), this is part of my workaround;
Create a post with a far future publish date (I used year 2500) but using the code above in functions.php to publishes it rather than scheduling.
This post then appears first in megamenu in date order.
I then had to place the ‘post masonry grid’ within this post via VC so it acted like a category. The post grid element for VC allows you to select a category for the post grid. Once set, I also had to exclude the main post I created from the grid as it was displaying code in the excerpt; some sort of odd ‘post in a post’ loop.

I actually wanted 4 specific posts to always display in the mega menu so I adjusted the far future date of each by a year so they would always appear first and in order.

Hope this might interest someone else.

Not perfect, but it does what I needed.

Post count: 11

Hi! I’ve found this post and it’s sort of what I need as well.
Actually, I wish I could set the order of my articles on the mega menu just like we do now on other sections of newspaper theme (where we can filter by article number, newest, etc)

I’ll leave it as a suggestion for future updates in Newspaper. Thanks!

Post count: 35449

Hi,

If you want you can try the new version of Newspaper, there are more options now, if you want to test it please test it first on localhost or on sub-domain
-> https://tagdiv.com/whats-new-in-newspaper-theme-9-5-update/

Thank you!

Post count: 8

Hi! Ah that’s a pity, that’s excactly what I need, too.

Might you provide a child theme code snippet – to filter mega menu posts by alphabetic order?!

This functionality is available for mostof the other blocks – so I hope it will come for mega menu in a future update soon ;). Thanks!

Post count: 35449

Hi @cobelfret,

Unfortunately for the moment the filter is not available for mega menu, maybe this will be implement in coming updates.

Thank you!

Viewing 13 posts - 1 through 13 (of 13 total)
The forum ‘Newspaper’ is closed to new topics and replies.