- This topic has 10 replies, 2 voices, and was last updated 6 years, 1 month ago by Leo.
-
AuthorPosts
-
March 15, 2018 at 12:21 pm #520954Margot
I looked around on the forum and didn’t seem to find an answer to this so here goes. I have been customizing my blog archive page but I noticed that all the changes I make to that on the customizer then modifies the outcome of my search results page. Basically, I set my blog archive page to have two columns and to hide the page excerpts and meta/tags but I want my search results page to be all in one column and to include the page excerpts.
Do I have to create a separate page template for the search results page in order to do this? I’ve been hiding the excerpts this way because if I set the excerpt to 0 on the customizer it leaves me with an ellipsis (“…”) :
.generate-columns-container .inside-article .entry-summary p:nth-child(1){ display:none!important; }
Thanks!
March 15, 2018 at 5:47 pm #521128LeoStaffCustomer SupportHi there,
Set columns on search page: https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns
Set excerpt on search page: https://docs.generatepress.com/article/generate_show_excerpt/#examples
Let me know if this helps.
March 16, 2018 at 8:11 am #521660MargotThanks for that! I was able to do the single column layout no problem.
I need a little help understanding how to do the opposite so to specifically hide the excerpt from the archive page though. I figured since most of the pages require the excerpt and the only one that would be hiding it would be the blog archive page, I think that’s probably the one that needs to be dealt with and not vide versa? Does $hide_excerpt do the opposite of $show_excerpt?
March 16, 2018 at 2:15 pm #521953LeoStaffCustomer Support$show_excerpt just returns the setting you set the in the customizer.
Try this snippet:
add_filter( 'generate_show_excerpt','lh_blog_hide_excerpt' ); function lh_blog_hide_excerpt( $show_excerpt ) { if ( is_home() ) return false; return $show_excerpt; }
March 16, 2018 at 4:13 pm #522035MargotAhh I see! Yes!! That seems to work except it eliminates the “read more” button that I still want to have there even if the excerpt is not. Is that even possible?
March 16, 2018 at 4:27 pm #522040MargotYou know what, I checked again and I was wrong, the snippet didn’t work. It looked like it just expanded all the posts and revealed the entire post and content for each.
March 16, 2018 at 8:31 pm #522104LeoStaffCustomer SupportActually try this instead:
add_filter( 'excerpt_length','lh_custom_excerpt_length', 1000 ); function lh_custom_excerpt_length( $length ) { if ( is_home() ) { return 0; } else { return $length; } }
Make sure excerpt it turned on in the customizer.
March 17, 2018 at 7:42 am #522299MargotThanks Leo! That worked! Is it possible to remove the […] or is that not possible?
March 17, 2018 at 9:50 am #522449LeoStaffCustomer SupportHmm try this CSS:
.blog .entry-summary p:not(.read-more-container) { display: none; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
March 17, 2018 at 12:28 pm #522543MargotThat’s it!! Thank you so much!
March 17, 2018 at 5:10 pm #522685LeoStaffCustomer SupportNo problem!
-
AuthorPosts
- You must be logged in to reply to this topic.