Looking for theme/customization option with relevant feature
-
I’m trying to set up a front page where the main page shows the two main categories, along with a thumbnail of the most recent post(s) in each of those categories.
I know it would be pretty simple to do a static front page showing these themes with a set image and to manually update it every few days, but a static image isn’t likely to sell the blog as being active to people checking by, and manually updating a thumbnail is not going to work for me, especially with scheduled posts. Is there possibly an HTML code or something I can insert on a page like this to cover that process?
The blog I need help with is: (visible only to logged in users)
-
Hi,
One way to produce what you’ve described might be to insert a table on a static front page, with two cells in the table and display posts shortcode inserted into each of the cells, the shortcode customized to display only the latest post and an featured image. See the following relevant support documents:
- Set a Static “Home” Page (Front Page)
- Tables section of the Advanced HTML support page
- Display Posts Shortcode
-
Each display post shortcode could be customized to display only posts in a certain category.
-
The table cells could also include links to the corresponding category pages. However, it might require CSS customization to hide the titles of the latest posts produced by the display posts shortcodes, and to have the featured images link to the corresponding category pages rather than the latest posts.
-
This looks like, in theory, it should work out perfectly. In practice, it doesn’t seem to be showing thumbnails, even when I put the code in (using theme Intergalactic 2) so I’m guessing there may be a theme dimension here.
-
In practice, it doesn’t seem to be showing thumbnails, even when I put the code in…
That’s odd, because I’ve tested display posts shortcode on Intergalactic 2, and it’s displaying featured images. In fact, I’ve been unable to stop a featured image from displaying with a post displayed by display posts shortcode even after taking the following steps:
- 1. removing the featured image from the post
- 2. deleting the image from the media library
Because of these unexpected results I’m going to call for staff attention to the topic.
Can you provide here the shortcode (or codes) that haven’t worked for you? Btw, in order to show a thumbnail image for a post with display posts shortcode, it might be necessary to set a featured image on the post. I don’t know if it will normally draw an image from the post on the Intergalactic 2 theme. Ordinarily I could test to find out, but I don’t trust the results I’m obtaining because of the irregular results I reported above.
-
Code that I’ve used:
[display-posts category="blog" image_size="thumbnail"]I also tried a longer version (specifically so that it would only show the single newest post) but I removed some of the extra qualifiers in case they interfered with the thumbnail, and it still wasn’t there.
This is creating a list of posts, but it is not including any thumbnails.
Possible issue: since Intergalactic 2 automatically uses the first image in the post as featured image, it may not be an official image in the sense that it’s recognized in the code. I’ll experiment some with this.
-
Update to this: I manually assigned a featured image to my latest post. Nothing seemed to change but checking back several hours later when I preview the new page the thumbnail seems to appear. So it seems that this was caused by a difference between the automatic featured image and manually assigned ones.
-
Looks like you got it sorted out, but to clarify:
1) For the shortcode you’ll have to explicitly set a featured image on the post. The automatic featured images on themes with Content Options enabled only applies to the theme. Display Posts, on the other hand, is part of the core WordPress software, so it won’t see the auto-featured image if the theme has that.
2) The shortcode is cached, so it can take up to an hour after you make a change before the shortcode will display it.
Let me know if you need any more help with this.
-
I am coming across one issue, where if I try to use the above suggestion with medium images, some of the titles are below the thumbnails, whereas some of the titles show two letters and then a bunch of hyphens to the right of the image and then the rest of the title underneath. (Example being, the word “Dinosaur” is displayed as “Di-
–
–
–
–
nosaur”) -
What I should have said explicitly in the post above is that if there’s a way to insert a line break between the image and the title that would be very helpful.
-
We can do this with custom CSS. Click on My Sites, then click the Customize button next to Themes. Then click on CSS and paste the following code into the CSS editor:
/* forces title link under image */ .display-posts-listing a.title { display: block; clear: both; } /* changes Latest Posts colum's images to right-aligned */ .moveright a.image { float: right; }I also made a minor edit to your table’s HTML – I had to add a class I could use to target the shortcode in the right-hand column, as the shortcode doesn’t have any unique classes to distinguish them if you use more than one shortcode on a page.
-
Looks like that did the trick! The only thing keeping it from being perfect is that when a title goes onto a second text line it causes the thumbnails to be out of alignment, but at that point I’m just nitpicking I’m sure.
-
That I don’t think can be fixed – the two shortcodes work independently of each other, so there’s no way to have one adjust based on the content in the other.
The only option I can think it so shrink the text so it fits in one line, but then you’ll be sacrificing readability. You’ll also have to target all text in the table column – no way to target individual posts inside the shortcode.
-
One issue that seems to have arisen from this – while when I first set up the page it seemed to update with new posts in the linked categories, which is what I’m aiming for. However, since the final update and CSS customization, it seems to have frozen on a single view of what were the newest posts at that time.
I thought this might be my own view, so I’ve attempted clearing the cache, viewing from a different browser, and viewing from a different device, and all are showing the most recent posts as of 8/22 and ignoring anything since then. I also tried removing the CSS to see if that was inadvertently causing the issue, but either that’s not having any effect, or it hasn’t updated yet.
-
It looks like you have two categories: Videos and podcasts, and Videos & podcasts. The first category is the one specified in your shortcode, but the two missing posts are assigned the second one. If you update their category to the one using “and” instead of & they should appear.
Note that the shortcode content is cached, so it can take up to an hour after you make the change before they update.
-
I thought I checked for this, but I could definitely see some of the software I use making an extra category that wasn’t intended. Egg on my face if that is indeed the reason.
- The topic ‘Looking for theme/customization option with relevant feature’ is closed to new replies.