This topic has 7 replies, 5 voices, and was last updated 10 years by sharmstr.

  • Author
  • #25765
     nichelead
    Participant

    Hi,

    My site is set to auto-display the featured image of a post at the top of the post.
    [Theme Options – Blog – Display media on post page (ON)].

    This option setting works fine for posts and some CPTs, but

    For some Custom Post Types I don’t want the feature image to be auto-displayed at the post.
    I create custom php template files to display single custom posts, and the problem is that the theme options setting I mentioned above keep displaying the large feature image at the top of the custom post.

    Can you please help me with a code snippet (at least until there is a setting in the theme options to select which post types) to insert in the function.php of the child theme, that will let me define which post types to exclude from this default theme behavior.

    Thanks 🙂

    #25919
     Catalin
    Moderator

    Hello,

    The template can be found here:

    C:\wamp\www\wordpress\wp-content\themes\sweetdate\content-image.php

    You can use this file by copying it in your child theme folder and remove this part:

    COPY CODE
    
    
          <?php 
          if (get_post_thumbnail_id()) { ?>
          <div class="twelve columns">
            <div class="article-media clearfix">
                <?php the_post_thumbnail();?>
            </div><!--end article-media-->
          </div><!--end twelve-->
          <?php } ?>
    
    

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #26298
     giorgos
    Participant

    I try to achieve the same. Do not display Featured image for some custom post types. How can I achieve this on Kleo?

    Thanks!

    #26330
     Abe
    Keymaster

    for custom post types try editing wp-content\themes\sweetdate\content.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #26384
     giorgos
    Participant

    Thanks Abe, but still not manage to achieve this. I have a custom post type (mycred_rank) and I want to have a featured image for this type as for the normal posts, but instead I don’t want the image to be displayed. (huge image is displayed at the top of the page, although the featured image is small)

    Can you help?

    #26394
     sharmstr
    Moderator

    I haven’t tested this, but I think you can copy /kleo/content.php to your child theme, then edit line 36

    COPY CODE
     <?php if ( kleo_postmedia_enabled() && kleo_get_post_thumbnail() != '' ) : ?> 

    to

    COPY CODE
     <?php if ( kleo_postmedia_enabled() && kleo_get_post_thumbnail() != '' && get_post_type() != 'mycred_rank' ) : ?> 

    Let me know if that works or not.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #26460
     giorgos
    Participant

    No need to test.. Works like charm. Thanks!!

    #26465
     sharmstr
    Moderator

    Awesome.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘disable featured image auto display in custom post type’ is closed to new replies.

Log in with your credentials

Forgot your details?