-
AuthorPosts
-
January 29, 2019 at 2:22 pm #1059998
Hi,
We have two categories in our blog, News and Stories. Default the sidebar shows the blogposts from all categories. What we like to achieve is to only display the posts of that particular category.
So when you click on a post associated with the category “News”, you’re send to the single blog page with in the sidebar only posts from that category.
Same with a post associated with the category “Stories”.Is that possible and, if so, how?
Best regards,
Steven
January 31, 2019 at 3:42 pm #1061018Hey Steven,
Yes, that’s possible however you’ll need to install and activate a plugin, you can try to use Widget Logic or similar widget plugins.
If you use widget logic you’ll need to know some conditional tags: https://codex.wordpress.org/Conditional_Tags
This way you can create 2 widgets, one shows posts for news category and one for stories, then set each widget’s visibility.Best regards,
NikkoFebruary 1, 2019 at 2:30 pm #1061559Hi Nikko,
Thank you for your answer. I do understand what you mean and how it should work. However I do not know what exactly I should use in the widget logic field. Could you be more elaborate ?
Thanks in advance!
Best regards,
Steven
February 1, 2019 at 11:34 pm #1061774Hi Steven,
I think for the first widget you just show the posts in the News category and in widget logic you just put:
is_single() && in_category('news')
then the 2nd one is Stories and the code to use is:
is_single() && in_category('stories')
Best regards,
NikkoFebruary 19, 2019 at 3:36 pm #1068995Hi Nikko,
Thanks for your answer and sorry for my late reply. I did figure out from this info, that the two pieces of code are most likely the ones to use. However, I really don’t know how to use it.
I can make two “Latest posts” widgets, one with: is_single() && in_category(‘news’) in the widget logic field and the other with: is_single() && in_category(‘stories’). Both widgets are placed in the Sidebar Blog. See screendump.
How do I set each widget visibility e.g. get it to work?Thanks in advance!
Regards,
Steven
February 20, 2019 at 3:58 pm #1069503Hi Steven,
As long as those conditions are met then it would toggle it’s visibility otherwise it won’t show up.
If it’s not working please post us your login credentials (in the “private data” field), so we can take a look at your backend.- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( do be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create a admin user and post the login credentials in the “private data” field.Best regards,
NikkoFebruary 21, 2019 at 3:49 pm #1069976Hi Nikko,
Please see PC.
Best regards,
Steven
February 26, 2019 at 11:32 am #1071715Hi steviger,
I apologize for the delayed response and thanks for the admin access.
It seems to work fine, in private content I posted a link for sample posts on your site with their respective category and you’ll see it works properly there.Best regards,
NikkoFebruary 26, 2019 at 12:22 pm #1071727Hi Nikko,
No problem and thanks for your time and effort. However, I’m affraid it’s not quite working yet. As you can see with your sample posts, only the title of the widget changes. The list of posts is still a combination of Actueel en Verhalen.
Best regards,
Steven
February 28, 2019 at 8:09 am #1072529Hi Steven,
I see the issue now and it’s not widget logic or the logical condition we added since you’ll see the widget title changed that’s because the two widgets you put are the same and the only difference is the widget title.
You’ll need to find another widget plugin which allows Posts by Category, then use that widget instead of Recent Posts which doesn’t have the option to select which category it will show.Best regards,
NikkoMarch 13, 2019 at 5:09 pm #1078311Hi Nikko,
Thanks, will look into that.
Cheers,
Steven
March 15, 2019 at 1:53 am #1078967Hi Steven,
You’re welcome.
We’ll keep this thread open until it’s resolved :)Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.