Show posts in sidebar – one category or tag
-
I really like the way I can show posts with a certain tag in the sidebar with the 2014 theme. But 2014 isn’t ideal for the website I’m trying to build. So is there a way I can do this in other themes? eg do shortcodes work in text widgets? Or can any of the other standard widgets be jiggled to do this?
The posts could be selected by category, tag or post type (assuming I can find a theme with post types) or even manually. In fact, both options would be useful.
1. I’m hoping to have lots of posts with quotes from group members and reviewers. I’d like some of them to show up in the sidebar, with a link to more. Best is if a random few show up and shuffle when you go to another page/post.
2. I’d like to be able to flag up the post for next event so it displays in the sidebar too.
I expect I could do this with a plugin on a hosted site. But I’m building the site for the group and need things to be as simple as possible for others to manage in the long term when ultimately I won’t be around. Which means not having to troubleshoot when a theme or plugin updates and something doesn’t work. So I’m hoping to do this on wordpress.com . If necessary on a premium site if there’s some customisation needed that can’t be done on the free sites.
Any suggestions?
Thanks.The blog I need help with is: (visible only to logged in users)
-
Hi there.
1. I’m hoping to have lots of posts with quotes from group members and reviewers. I’d like some of them to show up in the sidebar, with a link to more. Best is if a random few show up and shuffle when you go to another page/post.
It’s not exactly what you’re looking for, but have you looked at the Recent Posts or the Top Posts and Pages widgets?
https://en.support.wordpress.com/widgets/recent-posts-widget/
https://en.support.wordpress.com/widgets/top-posts-widget/Otherwise, the Display Posts shortcode will work if you add it to a text widget. The shortcode can be customised to display specific tags, categories, authors, posts with or without excerpts, etc. It’s a bit more complicated than the widgets, but the shortcode’s instructions are very clear and complete. https://en.support.wordpress.com/display-posts-shortcode/
I don’t know of an idea to display random posts this way, though. The shortcode will show the same content on each page where the widget appears.
2. I’d like to be able to flag up the post for next event so it displays in the sidebar too.
The shortcode should work for that too, but have you considered just setting that post to sticky so it appears at the top of the feed instead? https://en.support.wordpress.com/post-visibility/
-
Thanks very much. The display_posts shortcode looks like the way to go. I’ve got it partially working but with some glitches.
I’ve tagged some posts “featured” and am trying to display only those. it looked OK but when I untagged one of them, it’s still appearing. (I tried clearing cache and refreshing. No help.) What’s gone wrong?
Code I’m using is
[display-posts tag="featured" image_size="thumbnail" wrapper="div"]. I’ve set the widget not to be visible on home page, so try https://auntyclare.wordpress.com/about/ . The post “Cair Paravel Chorus – mixed voice choir” isn’t tagged any more so shouldn’t be there.Secondly, with the “Next concert” widget, it looks odd on widescreen. With the blue link text, “Next concert,” “Next” is beside the top of the thumbnail and “concert” is below the thumbnail. I’d prefer both below it, which is how it shows on a less wide screen.
Code I’m using is
[display-posts tag="next" include_excerpt="true" image_size="thumbnail" wrapper="div"].I’m guessing it’s to do with the wrapper and maybe I’m going to have to add some css once I’ve got the go-ahead from the committee to upgrade and go live. Will that be possible? Or even better, is it something I can do in the shortcode now?
And if anyone has ideas for how to generate a random or changing selection of quotes, that would be fantastic! Otherwise, I think we just tag a few and swap tags around every now and then to highlight another selection.
Thanks again.
ClareBTW, I’m not using recent posts or sticky because the site is mainly for information rather than blog and I think will be easiest for others to maintain if I mostly use pages rather than posts. And am trying a page for the home page, rather than posts.
-
Oh, I forgot to say: with the “featured” tag selection, I’ve given a couple of other posts the tag and they aren’t showing up. As well as the one I untagged still showing. Despite clearing cache and refreshing page.
-
The posts I can see in the right-hand widget are, from the top: Join Us, Book Us, Hear Us, Support Us, CPC Choral Bursary, Lucy Pevensie Hospital and We Gratefully Acknowledge… and in the Quotes one I see Another review, A review and A Comment. I don’t see the post you mention there at all, so perhaps it just took a while to update.
For the Next Concert Widget: I don’t know if shortcodes can be styled with CSS. You can ask in the CSS forum if something like this is possible: https://en.forums.wordpress.com/forum/css-customization#postform
But if you’re only displaying one post there it might be simpler to just add it using regular html for an image and a link. To have less-technical users do it, have them create a draft post and add the image and link to the actual post, then switch to the text editor and simply copy the html and paste it directly in the text widget.
And if anyone has ideas for how to generate a random or changing selection of quotes, that would be fantastic! Otherwise, I think we just tag a few and swap tags around every now and then to highlight another selection.
To generate random quotes you need either a third-party widget or your own JavaScript widget, neither of which we can use on WordPress.com, so I think you’ll need to do this manually.
-
Thanks for getting back to me so quickly and for your help.
Yes, the right “featured” posts are showing up for me as well now. I didn’t realise there’d be a delay before it’s updated. I’d spent a long time going in and out of the page, clearing cache lots of times, so am guessing at least quarter of an hour, probably a lot longer (time flies when you’re struggling with IT!).
When I first added the widget, the posts appeared within seconds. So updates seemed to be happening quickly. Similarly assigning categories and tags to posts. So I’m confused about why this particular update took so long.
For “next concert,” like you, I’d wondered about using html in the text box. But would need to add html for the image and would also want to include some link text. That way people know straight away that the next concert is Mozart or Christmas or whatever, and then can link to the post. It’s quicker and easier for people to update if we can do it just by adding and removing tags, rather than handwriting the html link text each time.
I’ll search and ask in the CSS forum as you suggest.
Thanks very much for your help. The prototype site is coming along nicely now :-)
-
I’m afraid I have no idea why it took so long to update. In my experience changing that shortcode should change the displayed text the moment you save the widget. If it keeps happening going forward, let us know.
It’s quicker and easier for people to update if we can do it just by adding and removing tags, rather than handwriting the html link text each time.
I understand. Then it would probably have to be via CSS, if possible, as I don’t know of any way to change the styling of the shortcode directly.
-
I think I’ve sorted random display!
In the short code, add
orderby="rand"Then to limit how many posts, I added
posts_per_page="3"I am a happy bunny!
Delay is still happening by the way.
-
Ah, okay. I’ve never clicked through to the WordPress.org page for that shortcode. Clever you :)
I’ve tagged this for staff to follow up on whether that delay is normal or a possible bug.
-
Thank you.
I’d love to claim I was that clever, but it was serendipity. I was searching for information about formatting the posts in the sidebar and came across this page of tips. Which happened to include the code for random display. (Though not the formatting information I’d been searching for!)
-
That is a post that refers to wordpress.ORG software installs only. Have you read my responses to you here? https://en.forums.wordpress.com/topic/yoko-turning-featured-image-header-off?replies=3#post-2462937
-
I haven’t looked back through the tips in the page of tips but the shortcode for displaying random selection of posts in my widget seems to be working fine on WP.com . And my understanding is that with a premium WP.com site, we can edit CSS. So I’m hoping some CSS will help the formatting.
-
@timethief
Apparently this shortcode shares some formatting options with the WordPress.org version. The support doc here links to the codex page over there. So in this case the WP.org tips work. -
Hi Clare,
Delay is still happening by the way.
Your site itself has its own cache (that’s separate from your browser’s cache) where it saves the details about the posts in your display posts shortcode. Because of that cache, it can take a little time for new posts to appear in that list of posts, so a small delay is normal. :)
-
Ah! Thanks for the explanation. And that fits with what I see: the first time I set up the shortcode, the posts display immediately. Presumably because there’s no cache yet. But when I tag a few more or untag some, it doesn’t show up till later.
Thanks.
Clare
- The topic ‘Show posts in sidebar – one category or tag’ is closed to new replies.