- This topic has 7 replies, 2 voices, and was last updated 5 years, 6 months ago by Tom.
November 19, 2016 at 12:43 pm #245875Lisa
I am in the process of converting a site that has about 1500+ posts. For the Posts Page, I would like to change the layout to show (by row) Post Title, Date & Author, Categories & Tags and then under that to the left show the first image in the post (not featured) image and to the right show the excerpt. On this particular site, they chose to insert an image in the post instead of use Featured image.
I don’t know what the terminology is but is there a script or filter that I can use that if there is no featured image, check for the first image in the post and use that instead?November 19, 2016 at 2:27 pm #245898TomLead DeveloperLead Developer
Hmm, not easy to do I’m afraid, but a plugin like this might help: https://en-ca.wordpress.org/plugins/quick-featured-images/
Let me know 🙂November 19, 2016 at 2:55 pm #245900Lisa
Thanks, I’ll check it out.
I had this working in the previous theme using W4 Post List. They use a function called “use_fallback” it’s in their documentation after you download the plugin but I can’t find a link online. I’d continue to use it but it doesn’t seem to be updated much and it’s conflicting with this GP theme.November 19, 2016 at 3:21 pm #245901TomLead DeveloperLead Developer
If the plugin I linked to doesn’t work, there should be a solution out there if you search for it.
Generally, I’m not sure if it’s a good idea as it would have to loop through every single post and insert the URL into the featured image meta value. If at any time you wanted to reverse this, it would be a huge pain/impossible to only remove the ones that were automatically added.
Of course, you could overwrite the post image function in your child theme and check to see if a featured image exists. If it doesn’t you could code in a fallback.
That way, nothing in your database would change.November 19, 2016 at 4:04 pm #245908Lisa
I am using a child theme (always), but don’t have a clue how to go about overwriting the post image function to use a fallback image and even if I use the plugin you mentioned, I’m sure my client will not remember to use featured image for future posts (some old dogs refuse to learn new tricks). I guess I’ll have to keep searching, if you have any other suggestions, please let me know.
BTW, mucho Kudos… this theme is absolutely fabulous and I am totally loving not having to create custom widgets. With the site I’m working on, I would have had to create 3 custom widgets in the header and then another custom widget for the footer, the GP Hooks saved me a ton of work. Thank you so much!November 19, 2016 at 4:08 pm #245909TomLead DeveloperLead Developer
Something like this might help: http://wordpress.stackexchange.com/a/64813/90661
It allows you to add a fallback to the featured image if it doesn’t exist.
You would have to find the necessary code to grab the image from the content to add it in there though.
Glad you’re enjoying the theme! Great to hear 🙂November 19, 2016 at 4:16 pm #245912Lisa
Thanks again but still no joy. I added it to my functions but no difference. If I don’t find a solution, I guess I’ll have to hire this part out so I can stick to the Design side of things.November 19, 2016 at 11:21 pm #245932TomLead DeveloperLead Developer
It won’t work as is, you would need to include a fallback image in there or code to grab the first image in the content.
You might have some luck asking on the WordPress stackexchange site 🙂
- You must be logged in to reply to this topic.