- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by
Tom.
-
AuthorPosts
-
November 18, 2019 at 12:27 pm #1066819
Angelica
I am trying to create a page with top posts but so far all I managed was to create a template and copy the contents of the archive page. Nothing works.
I can handle the query code (gonna use wordpress popular posts query), but no clue as to how to do it using GP.
What I want to achieve: https://anthemes.com/themes/food/popular/
What I have: https://doce.blog.br/topNovember 18, 2019 at 3:41 pm #1066931Tom
Lead DeveloperLead DeveloperHi there,
How are you setting the query right now? In a custom page template? If so, you should just be able to set your necessary options in your
WP_Query
call.Let me know ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 18, 2019 at 5:19 pm #1066989Angelica
I managed to get the query going, the title and description are all set.
But I still get no pagination, no images and no layout like the main blog (I’m using 3 columns).
Home: https://doce.blog.br/
I only copied the index.php template and added:
$query = new WP_Query( 'post_type=post&meta_key=views_weekly&orderby=meta_value_num&order=DESC');
And I have some filters to get my title and custom description for the page:
add_filter( 'get_the_archive_title', function( $title) { if ( is_page( 'top' ) ) { $title = get_the_title(); } return $title; }, 50 ); add_action( 'generate_after_archive_title', 'teste' ); function teste(){ if ( is_page( 'top' ) ) { $desc = '<div class="taxonomy-description">ssss%s</div>'; echo get_the_content(); } }
November 19, 2019 at 9:29 am #1067622Tom
Lead DeveloperLead DeveloperIt looks like you’re using WP Show Posts now, which is a really good idea. Otherwise, you’ll need to add those elements (pagination, featured images, columns) into your page template.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 19, 2019 at 10:02 am #1067652Angelica
Yes, it works great, I wish it inherited the layout options as well.
It’s an amazing plugin, Tom.
November 19, 2019 at 4:31 pm #1067891Tom
Lead DeveloperLead DeveloperGlad you like it! ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.