Tagged: x
-
AuthorPosts
-
October 25, 2016 at 4:21 pm #1230514
MBParticipantHi,
I would like to use a smaller image ans my portfolio item feature image. Right now it’s pulling the full size image.
Thanks, MB
October 26, 2016 at 12:21 am #1230929
LelyModeratorHi MB,
Thanks for posting in.
Please check this thread:https://community.theme.co/forums/topic/change-image-size-for-integrity-1-portfolio-pages/Hope this helps.
October 26, 2016 at 8:25 am #1231458
MBParticipantAdded code provided in the thread to functions.php in my child theme and no change.
October 26, 2016 at 9:47 am #1231591
ChristianModeratorHey MB,
Please add the code below in your functions.php
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: 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; } } }Then, change the image size in the
get_the_post_thumbnailfunction likeget_the_post_thumbnail( NULL, 'medium', NULL );For more details about that function, please see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/
Thanks.
October 26, 2016 at 9:57 am #1231607
MBParticipantOk thanks, I have that code placed in there, but I want the entry image in there. 895×9999
October 26, 2016 at 7:03 pm #1232279
RadModeratorHi there,
Instead of changing all image size, you can change this part
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; }to this
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' ) ) ), get_the_post_thumbnail( NULL, 'medium', NULL ) ); break; }Hope this helps.
October 27, 2016 at 4:04 pm #1233786
MBParticipantTo clarify:
We only want to change the feature image of single portfolio items (e.g. https://mbguiding.ca/adventures/west-coast-trail/) from the current full-size image (2400px) to the entry-image size (895px). Why does the single portfolio item use the full-size version as default?
Please send the complete code snippet for my child theme functions.php that will make the image smaller.
Thanks, MB
October 28, 2016 at 12:12 am #1234279
Paul RModeratorHi,
Here is the complete code.
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_singular('x-portfolio')) { $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; } } }Hope that helps.
October 28, 2016 at 11:23 am #1234926
MBParticipant[RESOLVED] That’s exactly what we needed, thanks Themeco! 😀
October 28, 2016 at 1:31 pm #1235086
RahulModeratorGlad we were able to help you out!
Let us know if we can help with anything else.
Thanks for choosing the X-theme.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1230514 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
