Archived topic
Move content below posts in Archive pages
12 replies · Started by Gianluca on April 13, 2021
Dear GP support,
I would like to ask you if it's possible to move the content for all archive pages (like the one in the tab private information) below the posts belonging to that category.
I've tried the solution here https://generatepress.com/forums/topic/content-below-posts-on-category-page/ but is not working on my website.
Also, I already use this snippet https://generatepress.com/forums/topic/remove-category-description-on-page-2-3-etc/#post-547434 to remove the description on the 2nd, 3rd etc page of archive pages.
Thank you in advance!
Hi Gian,
Give this CSS a try:
.archive .page-header {
order: 100;
}
Let me know :)
Hi Ying,
Thank you, it worked but the CSS move also the page title below the posts.
Is there a way to keep the elements in the following order: Page title > posts > archive description ?
Hi there,
Tom provides a PHP Snippet here - that will just move the description below the post loop:
https://generatepress.com/forums/topic/archives-at-the-bottom-of-articles/#post-1184179
Excellent, thank you!
Hi David, the snippet here https://generatepress.com/forums/topic/archives-at-the-bottom-of-articles/#post-1184179 works, but unfortunately the description on page 2, 3 etc keep showing up, even if I use this snippet https://generatepress.com/forums/topic/remove-category-description-on-page-2-3-etc/#post-547434
Any idea?
Thanks in advance
Hi there,
That's strange.
Can you link us to the page in question to check? (Perhaps, backend access as well)
I've used this snippet:
add_action( 'wp', function() {
remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
add_action( 'generate_after_main_content', 'generate_do_archive_description' );
} );
And it works well on my sandbox site here: http://elvin.wppluginsupport.net/category/featured/
"This is a test description for Featured category" is the test description and it clearly isn't showing even on paginated parts.
Hi Elvin, it's weird, I can see the description "This is a test description for Featured category" here at the bottom http://elvin.wppluginsupport.net/category/featured/page/2/ and here http://elvin.wppluginsupport.net/category/featured/page/3/
Screenshot 1 and 2 https://imgur.com/a/bApt8Rx
Ah I think I misunderstood what you wanted to do. I may have missed the context as I can't see what was added on the private information text field because it gets deleted when the post is marked "resolved".
Did you want to completely remove the title description and NOT add it back below the posts?
If so, do this:
add_action( 'wp', function() {
remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
} );
The line remove_action( 'generate_after_archive_title', 'generate_do_archive_description' ); removes the category description.
The line add_action( 'generate_after_main_content', 'generate_do_archive_description' ); adds it back after the main content.
Maybe I'm still missing the point. Can you clarify? Thank you.
Hi Elvin,
I'd like to know how to keep the elements of Archive pages in this order Page title > posts > archive description, and remove archive description only on page 2, 3 etc.
Let me know if you need more information, thank you in advance.
Ah alright.
If that's the case, try this PHP snippet:
add_action( 'wp', function() {
global $paged;
remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
if($paged == 0){
add_action( 'generate_after_main_content', 'generate_do_archive_description' );
}
} );
This checks the pagination. If page is the first page (($paged == 0)), it adds the description. else, it won't add in anything. :)
Perfect, thank you!
No problem. Glad you got it sorted. :)