Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1165285
    rsmith4321
    Participant

    Could I add something to my child theme functions.php to change the thumbnail size used for the entry-featured entry-thumb class. I want to switch the entry-featured thumbnail size for my large thumbnail size in the entry-thumb div at the beginning of each blog post. I can accomplish what I want in the following code, I just don’t know how to add this to my functions.php so it won’t be erased by a theme update. Thanks.

    if ( ! function_exists( 'x_featured_image' ) ) :
      function x_featured_image( $cropped = '' ) {
    
        $stack     = x_get_stack();
        $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;
    
        if ( has_post_thumbnail() ) {
    
          if ( $cropped == 'cropped' ) {
            if ( $fullwidth ) {
              $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL );
            } else {
              $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL );
            }
          } else {
            if ( $fullwidth ) {
              $thumb = get_the_post_thumbnail( NULL, 'large', NULL );
            } else {
              $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
            }
          }
    
          switch ( is_singular() ) {
            case true:
              printf( '<div class="entry-thumb">%s</div>', $thumb );
              break;
            case false:
              printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>',
                esc_url( get_permalink() ),
                esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
                $thumb
              );
              break;
          }
    
        }
    
      }
    endif;
    #1165843
    Lely
    Moderator

    Hi There,

    Yes, you can add that code on your child theme’s functions.php file. Child theme is safe from theme update.
    In case you don’t have a child theme yet, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    #1172194
    rsmith4321
    Participant

    Thanks, I’m just not sure exactly how to implement it. I would have to wrap it in a custom function correct? Could you just tell me how to implement the code so it would work in my child theme functions.php?

    #1172580
    Rupok
    Member

    Hi there,

    You need to add that code on your child theme’s functions.php file. If the code is correct then it should work.

    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1165285 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>