- This topic has 7 replies, 2 voices, and was last updated 3 years, 4 months ago by
Leo.
-
AuthorPosts
-
September 16, 2019 at 8:11 am #1010764
George
Hi. would you kindly share the following PHP function you use for:
1. Changing image sizes in archives only https://docs.generatepress.com/article/adjusting-the-featured-images/
2. Changing the read more text in the free theme version.
Thanks in advance.September 16, 2019 at 8:31 am #1010781Leo
StaffCustomer SupportHi there,
1. That depends on if your posts page is the front page or not. You can see all the conditional tags here though:
https://codex.wordpress.org/Conditional_Tags2. GP Premium is needed for that unfortunately. Otherwise you will need to overwrite this copy and paste this file and overwrite this line:
https://github.com/tomusborne/generatepress/blob/7fdcddf18209a84aaa75304ab23f768241e08ed4/inc/structure/post-meta.php#L299Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2019 at 9:33 am #1010829George
1. I should have mentioned this is for the free version too. Which of these two codes is correct?
add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' ); function tu_variable_image_sizes( $atts ) { // Set up our conditional if ( is_home() || is_archive() || is_search() || is_tax() ) { $atts[ 'width' ] = 740; $atts[ 'height' ] = 402; $atts[ 'crop' ] = true; } // Return our options return $atts; }
add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' ); function tu_variable_image_sizes( $atts ) { // Set up our conditional if ( is_home() || is_archive() || is_search() || is_tax() ) { return 'blog-thumb'; // Already registered thumbnail } // Return our options return $atts; }
September 16, 2019 at 9:42 am #1010836Leo
StaffCustomer SupportThat looks ok.
What if you go
! is_single()
for “is not single post”?Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2019 at 9:59 am #1010858George
This is the only code that worked.
add_filter( 'generate_page_header_default_size', function( $size ) { if ( is_home() || is_archive() || is_search() || is_tax() ) { return 'blog-thumb'; } } );
I want to exclude both single posts and pages, but show the new thumbnail size sitewide for homepage, categories, tags, search page, etc. How will your code look like? The full size image for single posts and pages scales nicely on mobile devices.
September 16, 2019 at 10:17 am #1010877Leo
StaffCustomer SupportYour code should work then ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2019 at 10:41 am #1010889George
Okay, thanks. I can now deploy the test site.
September 16, 2019 at 11:22 am #1010927Leo
StaffCustomer SupportNo problem ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.