1

I need: to have the ability to set one post as sticky in one category and not the others.

Example: So let's say i have this three categories: "one" "two" and "three". and i have a post named "sticky in one and two" and another post named "sticky in one".

Now i want the "sticky in one and two" post to be sticky in the category "one" and in the category "two" but not in the category "three".

And i want the "sticky in one" post to be sticky in the category "one" but not in the category "two" and not in the category "three".

Thoughts: I thought of trying something like add a taxonomy with the same terms as the categories terms ("one","two","three") and then to make two loops which in the first one i get the posts which have the name of the current category in there custom taxonomy terms (for example when i'm on the category "one" archive it will fetch only the posts that has "one" in this new custom taxonomy) and then a second loop which will get all the current category posts excluding the first loop posts. but it seem very complicated and i'm guessing one could think of a better way to do it, so please share your ideas...

Also a minor problem with this method is that i can check a term in the custom taxonomy which isn't marked in the categories taxonomy which could be confusing...

Thanks!

  • 1
    Nothing obvious leaps out. We've recently got the ability to add meta data to taxonomy terms, but not to term relationships which is what would make this easy. Perhaps you could store a list of post IDs in a term's metadata? – Andy Macaulay-Brook Jul 25 '16 at 16:41
  • Thanks but i'm looking for a solution which will give the ability to easily mark a post as sticky in different categories from the admin panel. – Ben Jul 25 '16 at 16:43
  • 1
    Well, yes, you'd need to build the interface too. – Andy Macaulay-Brook Jul 25 '16 at 16:45
  • You could also have a look at this: wordpress.org/plugins/category-sticky-post – Andy Macaulay-Brook Jul 25 '16 at 16:56
  • that's a nice plugin but he has the ability to set only one category and only one post per category. – Ben Jul 25 '16 at 17:10

Your Answer

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

Browse other questions tagged or ask your own question.