-
AuthorPosts
-
March 26, 2020 at 3:10 pm #1198066
Liebes Enfold-Team, ich möchte auf den einzelnen Beitragsseiten meines Blogs das Beitragsbild automatisch im Layout angezeigt haben. Obwohl ich in den Theme-Einstellungen unter Blog-Layout -> Stil einzelner Beitrag -> die Option “Einzelpost mit großem Vorschaubild (vorgestellen Bild)” gewählt habe, wird das Vorschaubild im einzelnen Blogbeitrag nicht angezeigt.
Wie kann ich das Beitragsbild automatisch ins Layout (gleich oberhalb des Beitragstitels) integrieren?
Vielen Dank vorab!
March 26, 2020 at 5:23 pm #1198121March 26, 2020 at 5:52 pm #1198138Hi Victoria, thanks a lot for your quick reply. I already activated the option “Show on single entry”, nevertheless, the post format on the single page doesn’t show a preview picture. What else can I do?
Thanks in advance
March 28, 2020 at 3:37 pm #1198602Hi simplystrategy,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaMarch 28, 2020 at 3:52 pm #1198609This reply has been marked as private.March 28, 2020 at 9:50 pm #1198697Hi Christina,
That option will work when posts are built with the Classic editor, if you build posts with the Advanced Layout Builder, you need to add the image or any slider on top of the page yourself.
If the blog posts are simple, no complex Advanced Layout Builder elements used, you might want to use Classic editor, then you will have the image rendered automatically.
Best regards,
VictoriaMarch 28, 2020 at 10:37 pm #1198720try this in your child-theme functions.php:
Here you can choose which of the image formats commonly used in Enfold you would like to use.
function thumbnail_in_content($atts) { global $post; return get_the_post_thumbnail( $the_id, 'entry_with_sidebar' ); // image-size you like to use - adjust to your needs } add_shortcode('postImg', 'thumbnail_in_content'); add_filter('avf_template_builder_content', 'avf_template_builder_content_postimage_mod', 10, 1); function avf_template_builder_content_postimage_mod($content = "") { if(is_singular('post') || is_singular('portfolio') ) { $featuredImage = do_shortcode("[postImg]"); $content = $featuredImage . $content ; } return $content; }
______________________________________
Just for Info – not to place in the child-theme
these are the used image sizes in Enfold:$avia_config['imgSize']['widget'] = array('width'=>36, 'height'=>36); $avia_config['imgSize']['square'] = array('width'=>180, 'height'=>180); $avia_config['imgSize']['featured'] = array('width'=>1500, 'height'=>430 ); $avia_config['imgSize']['featured_large'] = array('width'=>1500, 'height'=>630 ); $avia_config['imgSize']['extra_large'] = array('width'=>1500, 'height'=>1500 , $avia_config['imgSize']['portfolio'] = array('width'=>495, 'height'=>400 ); $avia_config['imgSize']['portfolio_small'] = array('width'=>260, 'height'=>185 ); $avia_config['imgSize']['gallery'] = array('width'=>845, 'height'=>684 ); $avia_config['imgSize']['magazine'] = array('width'=>710, 'height'=>375 ); $avia_config['imgSize']['masonry'] = array('width'=>705, 'height'=>705 , $avia_config['imgSize']['entry_with_sidebar'] = array('width'=>845, 'height'=>321); $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1210, 'height'=>423 );
March 30, 2020 at 11:25 am #1199042Thanks a lot for solving my problem!!
Best regardsMarch 31, 2020 at 5:42 pm #1199371Hi simplystrategy,
Glad you got it working for you with Guenni007’s help! :)
If you need further assistance please let us know.
Best regards,
VictoriaApril 10, 2020 at 8:25 am #1202606just for info: we do not need the shortcode
and because on the most cases it makes no sence on showing the featured image on a post or portfolio created with advanced layout builder – we can use the meta box setting of showing or not showing the featured image.
add_filter('avf_template_builder_content', 'avf_template_builder_content_postimage_mod', 10, 1); function avf_template_builder_content_postimage_mod($content = "") { if( is_singular('post') && ( '1' != get_post_meta( get_the_ID(), '_avia_hide_featured_image', true ) ) || is_singular('portfolio') && ( '1' != get_post_meta( get_the_ID(), '_avia_hide_featured_image', true ) ) ) { $featuredImage = get_the_post_thumbnail( $the_id, 'entry_with_sidebar' ); $content = $featuredImage . $content ; } return $content; }
-
AuthorPosts
- You must be logged in to reply to this topic.