Limit to posts in same main category ?
-
Hi Ajay ..
as always, love your plugin and happy to contribute to it ??We’re using it on our news portals to show “related” content, as text headlines only, without images in simple bulleted list.
In our case, wanted to know if there is a filter to specify only search posts from “same main category” (or paid extension perhaps) … ?
We’re using John Havlik’s excellent Breadcrumb NavXT plugin, and his Order Bender solution for specifying a “primary” category (it works better than similar function in Yoast SEO, broken in 3.2.5 of Yoast SEO, for example). This works well as it sets a primary category for breadcrumbs, but also then sets a “main” category which gets picked up by other stuff (including Yoast), to set a main article section for OG tags
(e.g.,
<meta property="article:section" content="Books and Publishing"/>
)Anyway — my thinking was if there was a way to pickup the “main” category to only show related posts from that topic, would be great.
Right now with a book post news item, we are getting a “related” item in finance, simply because it shares a similar “dateline” of Denver, and not because it’s book related.
Maybe I need a different approach, but problem with most “show more from same category” solutions, only pickup “first category” assigned vs “primary/main category assigned” — since we are a news portal, we have to do multiple topics like Denver, Colorado, Books and Publishing, and Music since a music history book. Lowest alpha is Books, but that would not be the case with financial news under “Finance” in Denver, where Colorado would be lowest alpha. Even more tricky is solutions based on category ID, which also not ideal since Denver might have lower ID number than Books. (etc.)
Anyway … food for thought. I didn’t look back through threads to see if this has come up before.
Works great as-is; but for our main site a way to possibly grab the main cat from Order Bender — which is basically making a custom field, really, but with nice selector box for existing categories when making new post. That plugin appears to make custom field “mob_category_prefered” — which in our setup is nicely right under “crp_related_posts_manual” ??
So, in this new setup — category ID set from Order Bender and written to custom field mob_category_prefered = 66 — which = Books and Publishing.
SO, after rambling on there a bit — possibly a filter could be used in functions.php to set related posts plugin to pull ‘related posts from category = (mob_category_prefered(0000))’ or somesuch (not actual code example, of course. ??
Thanks for your time, and again all the great plugins.
(just sent you small moola for your time/efforts).Chris S.
(oh yeah – and we’re placing it as a if exists php element below story sections, in our template and not auto-inserting)
- The topic ‘Limit to posts in same main category ?’ is closed to new replies.