Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1310273
    Matt Mintun
    Participant

    Hey! I have a custom post type that I customized for its archive page and it’s single article page called “Projects”. So far the functionality is working well. I added in CSS into the customizer to make the featured image full width on the single article page and put the title of the article overlayed over hte featured image. All of this I’m liking.

    Where I’m seeing an issue is that when I inspect the image, it looks like X is pulling an image that is 1130px wide, which is obviously being stretched on my 1920×1200 screen. The image I uploaded is 2000px wide, so I’m wondering if there’s a way to tell X to pull the 2000px wide original image to show as the featured image. I’m assuming X is pulling the 1130px wide version since it’s likely seeing that my site is 1130px wide in Customizer yet I’m using CSS to pull that featured image full width.

    So again – is it possible to tell X using the Functions file (or a file I can put into my child theme) to pull the 2000px wide version of the image (I’ll make sure I always upload a 2000px wide image for this sake) and only for the custom post type “projects”? I don’t want this to affect regular blog posts.

    I’ll send the URL and admin access to the site in a private message right after this, since the site is in Maintenance Mode.

    And a 2nd sort of unrelated but pretty related question – I created an archive page for my custom post type, and it’s almost functioning as I’d expect. Is it possible to pull excerpts from the copy in Cornerstone on the archive page? Right now I have to hardcode the excerpt for it to show up, but I want this to be as easy as possible for my client, so having X pull the excerpt from the content in Cornerstone would be even better.

    Thank you!!
    Matt

    #1310274
    Matt Mintun
    Participant
    This reply has been marked as private.
    #1310649
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! To resolve your issue and display the full original image resolution, since the child theme is set up, please add the following code in your child theme’s functions.php file

    // Use original image resolution in single blog post featured image
    // =============================================================================
    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, 'entry-fullwidth', NULL );
            } else {
              $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
            }
          }
    
          if ( is_single() ) {
            //
            // you can use 'thumbnail' or 'medium' or 'latge'
            //
            $thumb = get_the_post_thumbnail( NULL, 'full', 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;
    // =============================================================================

    We would loved to know if this has work for you. Thank you.

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