1

I want to create widgets which will display based on post. I have considered the option of creating a widget post type using Advanced custom post type plugin and populate this widget while writing post. What I want to understand is, is there any out of box functionality available which can be achieved easily. Or in other word if a widget can be customised to be display based on blog post?

Thanks & Regards

  • wath do you mean with based on blog post ? show us a example – mmm Jun 27 '16 at 11:53
  • probably the easiest way is to run a shortcode in a text widget, eg. add_filter('do_shortcode','widget_text'); then just create a shortcode that outputs what you want using custom fields... – majick Jun 27 '16 at 11:53
  • Thanks for response, what I mean is I want to display widgets in the blog post side bar these widgets would be of advertisements. The advertisements has to be specific to blog contents. For example If I wrote about dairy product in my blog post I want to show advertise based on dairy product in the widget. To be specific I am using press customizers hueman theme. Hope it makes the question clear. – Jeet Jun 27 '16 at 11:57
2

Since it sounds like you're trying to do this without code I would do it this way: Create an 'Advertisement' post type which supports categories. Then use a 'Related Posts' widget that allows you to select custom post types as well as related categories.

Possibly one of these And use the widget settings to call the appropriate Ad

UPDATE: Not sure how clear my answer is but to use your example - you have a blog post in the category 'dairy' in your sidebar you use the 'Related Posts' widget to display posts of type 'Advertisement' in the category of the current post. Obviously, set up your Advertisement posts in the appropriate categories.

  • I would do the code if absolutely required. I would however prefer if this can be done using child theme function or without any further customisation at code level. Nonetheless thanks for the response I really appreciate you taking time to respond. – Jeet Jun 27 '16 at 13:14
  • Sure thing. If that plugin arangement doesn't work let me know or open a new question and I can help out with the code. – dg4220 Jun 27 '16 at 13:16

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.