-
Neal Umphred
I am using GeneratePress theme 3.4.0 and GP Premium 2.4.0.
I have Container Width set at 800 px, which is fine for the homepage.
But I want the featured images on individual posts to be larger (at least 1000 px).
What is the most effective way to achieve this?
-
Hi there,
You can use a block element – hook to insert the featured image outside the content container, and disable the default one from the theme.
Can I have a look at one of your single post?
Let me know 🙂
-
Neal Umphred
YING
Thanks for your prompt response.
I forgot to mention that I use the Classic Editor.
Here is a link to a post: https://www.gcc-globalclimatechange.com/southwest-white/
NEAL
-
Alvind
Hi Neal,
In order to do that, first go to Customize > Layout > Blog. Then under Featured Images, click the Posts tab and uncheck the Display Featured Images option.
Then create a new Hook element in Appearance > Elements, and inside the content area add this code:
<?php if ( is_single() ) : if ( has_post_thumbnail() ) { ?> <div class="featured-image-after-header"> <?php the_post_thumbnail(); ?> </div> <?php } endif; ?>
Set the Hook to
generate_after_header
, check the Execute PHP option and under Display Rules, set Location to Posts > All posts.Lastly go to Customize > Additional CSS, add this:
.featured-image-after-header { margin-left: auto; margin-right: auto; max-width: 1000px; } .featured-image-after-header img { width: 100%; }
-
Neal Umphred
ALVIND
Thanks for the prompt response!
I followed your instructions to “check the Execute PHP option” where I met an obstacle: it reads “Unable to execute PHP as DISALLOW_FILE_EDIT is defined.”
NEAL
-
Alvind
Do you have any security plugins activated? If so, try deactivating them first and then retry.
-
Neal Umphred
A
I deactivated all plugins except GP Premium but “Unable to execute PHP as DISALLOW_FILE_EDIT is defined” remains.
N
-
Alvind
Okay, so the constant may be added to the
wp-config.php
file. Can you ask your hosting if they can temporarily remove this line from there, if possible?
define( 'DISALLOW_FILE_EDIT', true );
-
Neal Umphred
A
Yes. I will contact them.
I will inform you as soon as I hear back from them.
Thanks and have a good night!
N
-
Alvind
No problem, just let us know 🙂
-
Neal Umphred
A
I am still waiting to hear from my host support. It probably won’t be until after weekend.
I did get close to what I want with this:
• I increased Container Width to 1000 px.
• In Blog > Featured Images > Archives, I set Width to 800 px.
This works fine on the individual pages but does not contain individual post titles and meta on the home page.
https://www.gcc-globalclimatechange.com/
I will try tweaking these two with CSS Hero (unless you have a better suggestion).
Best,
N
-
Alvind
Hi Neal,
Have you heard back from the hosting support?
The layout is actually easy to achieve if you can use Block Element, but since you’re not using the block editor, we have to approach this in an alternative way as I suggested earlier.
-
Neal Umphred
A
The person at my host’s support that I prefer to deal with does not work on weekends.
I hope to hear from him today.
N
-
Neal Umphred
A
Success!
It turns out that the line define( ‘DISALLOW_FILE_EDIT’, true ); had been added to my sites via a long-since deleted plugin.
My host cleared all my sites of the DISALLOW_FILE_EDIT line. Then, using your method and codes above, I have increased the size of my posts’ Featured Images to the desired width of 1,000 pixels.
Thanks!
N
-
Alvind
Awesome, glad to hear that!
- You must be logged in to reply to this topic.