Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1060823

    I am having trouble finding “><?php the_post_thumbnail(); ?> or equivalent so I can add a play button for my video thumbnails so it could be displayed as a video on my sicial media sites.

    Any help would be appreciated.

    #1060831
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! To get the permalink of the thumbnail, please use <?php the_post_thumbnail_url( $size ); ?>. For more details, you can check out the codex:
    https://codex.wordpress.org/Function_Reference/the_post_thumbnail_url

    Hope this helps.

    #1060921

    excuse me for my ignorance, i’ve tried to lookup that

    <“><?php the_post_thumbnail(); ?>
    and replace it with

    <?php if ( in_category( ‘video’ )) : ?>

    “><?php the_post_thumbnail(); ?><span class=”playbutton”></span>

    <?php else : ?>

    “><?php the_post_thumbnail(); ?>

    <?php endif; ?> but i just cant seem to find it

    #1060939
    Lely
    Moderator

    Hi There,

    Thanks for writing in! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us the link of the page where you want to implement this changes plus a little more clarification of what you want to achieve, we’ll be happy to provide you with a response once we have a better understanding of the situation.

    #1061056
    This reply has been marked as private.
    #1061099
    Rue Nel
    Moderator

    Hello There,

    Because what you are trying to accomplish requires a template customization, we would like to suggest that you use 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.

    Once you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

      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, 'entry-fullwidth', NULL );
            } else {
              $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
            }
          }
    
          switch ( is_singular() ) {
            case true:
              if ( in_category( 'video' )) {
                printf( '<div class="entry-thumb"><span class="playbutton"></span>%s</div>', $thumb );            
              } else {
                printf( '<div class="entry-thumb">%s</div>', $thumb );
              }
    
              break;
            case false:
              if ( in_category( 'video' )) {
                printf( '<a href="%1$s" class="entry-thumb" title="%2$s"><span class="playbutton"></span>%3$s</a>',
                  esc_url( get_permalink() ),
                  esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
                  $thumb
                );          
              } else {
                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;
          }
    
        }
    
      }

    Hope this helps.

    #1062617

    I have the child theme active and ready. I also copy/pasted the code in my child’s theme functions.php file. what else do I need to do to get the play button result.

    #1062912
    Paul R
    Moderator

    Hi,

    Does the code provided above still doesn’t work?

    Can you provide us your site url so we can take a closer look.

    Thanks

    #1063133
    This reply has been marked as private.
    #1063197
    Paul R
    Moderator

    Hi,

    Please make sure your posts are added to the video category.

    If that doesn’t help, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #1063264
    This reply has been marked as private.
    #1063431
    Christian
    Moderator

    Hey there,

    Sorry for the confusion. X supports several post formats and that includes the Video Post Format (see attachment). Please set your post to it so the video will be featured instead of the featured image (see attachment). See https://community.theme.co/kb/meta-options-posts/ for more details.

    Other methods are technically possible however, that would require custom development which falls outside the scope of our support. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://community.theme.co/custom-development/

    Thank you for understanding.

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