4

Within wp-admin, we need the ability to select a single post as the featured post. This featured post will be displayed on all pages. I know I can make a post "sticky" but we would like to have only one item featured -- and using "sticky" could mean that multiple items are featured.

Is there a way to have wordpress un-check all other "sticky" values when a content editor selects another as "sticky"?

If not, is there a better approach to this, like creating a widget that allows the content editor to select a single post?

Thank you.

  • 3
    Off the top of my head... I might create a meta box for a Featured custom field. This would just be a checkbox - which would save the current timestamp in the DB. Then later you can have wp_query select the post with the most recent featured timestamp. – vancoder May 26 '16 at 22:24
1

It sounds like the simplest and most flexible approach is to find a plugin that creates a widget for you that you can configure to display any post of your choosing in whatever fashion you prefer. Then you put that widget in the sidebar that appears on all of your pages. I would not develop this custom because it is an obvious problem that others have solved many times over.

In other words, there are plugins out there that do just this. For example, I found a couple of plugins in a Google search: Ultimate Posts Widget and Flexible Posts Widget. Many robust theme frameworks also include this feature, such as Themify, just to name one.

A second approach in the same vein is to install the Display Posts Shortcode plugin, and then put one of their configurable shortcodes into a Text widget that resides in your sidebar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.