Site logo

Archived topic

Please with adding some code to the theme

12 replies · Started by Natalia on February 20, 2020

Viewing posts 1–13 of 13

Hello,

I want to to use this plugin here
https://github.com/billerickson/category-landing-page

For creating Categorie Landing Pages.

In the explanation of the plugin it says:
"You'll need to do a bit of coding to get the landing page content to appear on your category archive pages. Every theme is different so I recommend you talk to your theme developer for guidance on how to add this.

Add the following code where you would like the landing page content to appear:

if( function_exists( 'category_landing_page' ) )
category_landing_page()->show();"

So, I am not sure, where to add this on generate press. Can you please help me here?

Thank you
natalia

Hi there,

try this:

1. Create a new Hook Element
https://docs.generatepress.com/article/hooks-element-overview/

2. Add this code:

<?php
if( function_exists( 'category_landing_page' ) )
	category_landing_page()->show();
?>

3. Select the before_main_content hook

4. Check Execute PHP

5. Set your Display Rules to Category Archives

Hello David,

thanks for your answer. Sadly it does not work.

Or maybe you have another solution as this plugin? I need to design the archives like normal page with gutenberg.
I know I could create a page called "pasta recipes" and a categorie named the same and then redirect the categorie archive to the specific page that I could fill with my content. But then I do have another issue because I cannot find a way to not just the latest posts but the real archive loop post with all posts from that category with pagination.

Maybe you know how can I solve this? Or can I maybe create a category-archive-loop that I include on a normal page but has that archive pagination behaviour like categorie archives?

Ok thank you for your help!
To that way you show...is it possible to use it with pagination?

If you use the WP Show Posts Plugin to display the list - you can include Pagination on one list.

I am not sure what you mean by the redirect ? Are you saying that link takes you elsewhere let me know.

Where would I add this here:

To do this, you need to add this function to your site.

add_filter('request', function( array $query_vars ) {
if ( is_admin() ) {
return $query_vars;
}

if ( isset( $query_vars['category_name'] ) ) {
$pagename = $query_vars['category_name'];

$query_vars = array( 'pagename' => "$pagename" );
}

return $query_vars;
} );
https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/?

Hi David,

ok I added the php code and installed the WP Show Post Plugin, but I see this checkbox : Seitennavigation
Die Seitennavigation sollte nur genutzt werden, wenn deine Beiträge das Einzige im Inhaltsbereich sind, um Probleme mit doppeltem Inhalt zu vermeiden. (its german)

So my question is? Isnt it possible to use pagination due to the double content issue?

And what ist that Ajax Pagination that comes with PRO? Whats the difference between Ajax and normal pagination?

Can i ask - what type of content are you wanting to add to the Archives ? And will it be consistent across the archives - can you share an example?

There may be a better solution.

This archived topic is closed to new replies.