Tagged: x
-
AuthorPosts
-
August 31, 2016 at 3:13 pm #1155641
neodjandreParticipantHi,
I have noticed that my search results contain the full size of the image I upload to a post, which make them very slow to load.
How could I make it display a smaller image size?
From my understanding, the theme already creates smaller scaled versions of the images I upload (?).
many thanks for your help!
August 31, 2016 at 3:30 pm #1155673
neodjandreParticipantOn another note, I think the search results are showing the size of the featured image in the post.
So I will look into this myself on how to adjust featured images because i am using ACF. thanks anyway!
August 31, 2016 at 4:10 pm #1155735
Nabeel AModeratorHi there,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
September 26, 2016 at 1:19 pm #1191199
neodjandreParticipantThis reply has been marked as private.September 26, 2016 at 5:42 pm #1191496
DarshanaModeratorHi there,
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 credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
September 26, 2016 at 6:27 pm #1191516
neodjandreParticipantThis reply has been marked as private.September 27, 2016 at 1:35 am #1191823
LelyModeratorHi There,
Thank you for the credentials. To use cropped version of featured image on search page, please add the following code on 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: printf( '<div class="entry-thumb">%s</div>', $thumb ); break; case false: if(is_search()){ $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL ); printf( 'YENG<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 ); }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.
September 27, 2016 at 10:08 am #1192417
neodjandreParticipantHi,
This is taking the image with with width 862px which is still too much. I would rather take the cropped image with width 300px.
Also I suppose the text “YENG” in your code is for testing purposes ?
September 27, 2016 at 10:51 am #1192490
ThaiModeratorHi There,
Please update the previous code to this:
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: if(is_search()){ $thumb = get_the_post_thumbnail( NULL, 'medium', NULL ); 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 ); }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 it helps 🙂
September 27, 2016 at 11:33 am #1192550
neodjandreParticipantyes thank you 🙂
September 27, 2016 at 11:49 am #1192571
ThaiModeratorYou’re most welcome 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1155641 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
