- This topic has 7 replies, 3 voices, and was last updated 2 years, 3 months ago by David.
-
AuthorPosts
-
January 4, 2022 at 10:22 am #2069075Javier
I have noticed that when I deactivate with the generate press premium plugin the featured image on a page, it is hidden with display: none
I don’t think this is the best way to disable an element. I think it should be disabled by not calling the function that paints the HTML of the featured image instead of always calling it and then putting a display: none.
Do you think this could be fixed for a future update?
Older queries have already reported this problem and have not changed it for the image. I don’t think the best thing to do is to load the image and then hide it with a display:none because that means that the page takes longer to load and the performance is lost.
January 4, 2022 at 10:40 am #2069096JavierI have seemed to discover that when in the customizer you configure to show featured image on pages above the content is when the featured image is loaded on the page and then hidden with a display none.
If you set display image above the title or below the title, when I disable the featured image element, it no longer loads in the HTML.
January 4, 2022 at 10:43 am #2069102Javierwhat I said before is wrong, it still loads the featured image and hides it with display: none
You should fix this behavior
Thanks
January 4, 2022 at 10:45 am #2069104YingStaffCustomer SupportHi Javier,
Are you talking about the disable elements in the page editor?
Can you try using a layout element instead?
January 4, 2022 at 10:53 am #2069121JavierIf I use disable elements creating a design from the element editor it works fine but, I am not interested in using a design element. I am interested in using the disable elements options for the reason that then my client will have the option to disable or enable from each page that will be easier than having to teach him to do it from the element editor that is more sensitive to error.
January 4, 2022 at 12:24 pm #2069220YingStaffCustomer SupportI just talked to Tom, he would look into it 🙂
For now, I would recommend using layout element.
January 5, 2022 at 1:42 am #2069640JavierWill I get an answer soon?
January 5, 2022 at 3:42 am #2069736DavidStaffCustomer SupportHi there,
it will require an update to GP Premium, which we will look to include in the next update. In the meantime you can try the following:
1. Create a Layout Element to Disable the Featured Image.
1.1 Do not set any Display Rules for the Element.
1.2 Whilst editing the layout Element inpsect the URL in the browser field and get the elements ID.2. Add this PHP Snippet:
add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 123 === $element_id ) { // Only target specific Element if ( has_post_thumbnail() && get_post_meta( get_the_ID(), '_generate-disable-post-image', true ) === 'true' ) { $display = true; } } return $display; }, 10, 2 );
Change the
123
to match your Elements ID.This should apply the Layout Element to disable the featured image IF the post has a featured image and the disable featured image option is selected.
-
AuthorPosts
- You must be logged in to reply to this topic.