- This topic has 31 replies, 4 voices, and was last updated 3 years, 4 months ago by
Manuel.
-
AuthorPosts
-
December 19, 2022 at 1:34 am #2466621
Manuel
Hi team,
I would like to have, only on one category page 3 columns (without excerpt just title), but not on the archive page.
I want to let my archive page without columns.
My archive page is this one: https://manuelmeszarovits.com/journal/
My category page is this one (where I want the columns): https://manuelmeszarovits.com/category/photo-of-the-day/I was looking for that on the forum but didn’t find a solution.
If I enable Columns in Customizer > Layout > Blog –> Columns it make it for all archive page!So what is the solution?
In advance thank you for your time,
ManuelDecember 19, 2022 at 1:43 am #2466632Fernando Customer Support
Hi Manuel,
To clarify, are you looking to alter the column number for specific archive pages?
If so, you’ll need a PHP snippet.
See here for reference: https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns
So for instance, you can try adding:
add_filter( 'generate_blog_get_column_count','tu_search_column_count' ); function tu_search_column_count( $count ) { if ( is_category('photo-of-the-day') ) { return 33; } return $count; }Replace ‘photo-of-the-day’ of the day with the archive slug, and
33with your desired column length.33produces a 3-column layout.December 20, 2022 at 3:25 am #2467954Manuel
Hi Fernando!
Sorry I didn’t get the notification of your answer.
Yes I’m looking for 3 columns on the archive page https://manuelmeszarovits.com/category/photo-of-the-day/So I put the PHP snippet in the functions.php but nothing happened.
Thanks,
ManuelDecember 20, 2022 at 5:40 am #2468075David
StaffCustomer SupportHi there,
the columns need to be active for that function to work.
So instead.1. remove the function Fernando provided.
2. activate the Blog Columns in Customizer > Layout > Blog
3. add this PHP Snippet to disable the columns everywhere except for your categoryadd_filter( 'option_generate_blog_settings', function( $options ) { if ( !is_category('photo-of-the-day') ) { $options['column_layout'] = false; } return $options; });December 20, 2022 at 6:51 am #2468140Manuel
Working very good David!
But two more thing:
– How to don’t have excerpt on category’photo-of-the-day’?
– How to have bigger photo who keep all the 1200px of the container?
Thanks,
ManuelDecember 20, 2022 at 7:48 am #2468213David
StaffCustomer SupportFor the excerpt:
add_filter( 'excerpt_length','lh_custom_category_excerpt_length', 1000 ); function lh_custom_category_excerpt_length( $length ) { if ( is_category('photo-of-the-day') ) { return 0; } return $length; }For the image – do you want each post to have a larger image so it fills its column ?
December 20, 2022 at 7:53 am #2468359Manuel
Working good David!
Just I still have “…Read more”. I want only the title of the post.
Yes I want the image to fill all the container on the 3 columns.
Thanks David,
ManuelDecember 20, 2022 at 12:49 pm #2468627Ying
StaffCustomer SupportHi Manuel,
Can you try adding this PHP snippet to remove the “read more”?
add_action('wp', function() { if (is_category('5')) { add_filter( 'generate_excerpt_more_output', function() { return ''; } ); } });And this CSS for the images:
.archive.category-5 .post-image img { width: 100%; }December 20, 2022 at 1:29 pm #2468661Manuel
Working perfectly, all two, Ying!
Last question and after I stop to bother you 😉
On this category, ID 5, I want to hide the pagination on every single post (like on this one: https://manuelmeszarovits.com/african-woman-walking-bush/), because the pagination is not only the category but all the archive?
In advance thank you so much,
ManuelDecember 20, 2022 at 1:50 pm #2468686Ying
StaffCustomer SupportDo you mean the post navigation at the bottom of the post?
https://www.screencast.com/t/g85QGzZ1If so, it’s using a
block element - post navigation:https://docs.generatepress.com/article/block-element-post-navigation/1. You should be able to find it at appearance > elements.
2. If you want to remove it from this category, go to edit that element, add
post category > this categoryto the exclusion list of the element’s location.If you want to create a new post navigation within the same category, do the above 2 steps, then:
3. Copy all the content from this element to a new block element. Here’s a video that shows how to do that on page editor:
https://youtube.com/watch?v=CsT1UOzZUgI&si=EnSIkaIECMiOmarE4. Toggle the
in the same termoption:https://docs.generatepress.com/article/block-element-post-navigation/#in-same-term5 .Choose Post navigation as element type, choose the same hook as the original element, add
post category > this categoryas the location.Let me know 🙂
December 20, 2022 at 11:28 pm #2468970Manuel
Thank you so much Ying. I didn’t dare to ask you for the navigation for the category.
So I made everything but the result is not good with repetition of the pagination for the archive but not for the category. Have a look: https://manuelmeszarovits.com/african-woman-walking-bush
I join you a screen print of the element page to see what I made: https://manuelmeszarovits.com/wp-content/uploads/2022/12/screen-print-element-pagination-pic-day.jpgThanks,
ManuelDecember 20, 2022 at 11:49 pm #2468982Manuel
I exclude now from the element archive pagination to don’t repeat but I still have the archive pagination instead the pic of day pagination!
December 20, 2022 at 11:49 pm #2468985Fernando Customer Support
Hi Manuel,
For clarification, what repetition are you referring to? Can you take a screenshot of this issue as well?
December 20, 2022 at 11:56 pm #2468989Manuel
Thanks for your quick reply Fernando.
I don’t have any more the repetition because from the element page archive pagination I excluded the pic of day category.
So the problem now is that instead to have the pagination of pic of day I have the pagination of archive.
I sent you a screen of the element page pagination pic of day to see what I made wrong.December 21, 2022 at 12:09 am #2468996Fernando Customer Support
Can you expound a bit more on the issue? Are you referring to a Block Element not appearing as it should on a page? Or, are you referring to the pagination in itself not working as you expect?
-
AuthorPosts
- You must be logged in to reply to this topic.