- This topic has 5 replies, 3 voices, and was last updated 5 years, 3 months ago by David.
-
AuthorPosts
-
December 29, 2018 at 2:43 am #768321Fernando
I would like to know if there is any way (other than hide them by CSS), not to show the entries in the pages of the categories.
This I want to do because I have a design (made with Elementor) which I insert as a Hook in “Elements”.
The problem is that also appear the post that shows Generatepress.Thank you very much!
December 29, 2018 at 9:07 am #768615TomLead DeveloperLead DeveloperHi there,
There are a couple options.
1. Set up 301 redirects from your category archives to your pages.
2. Do something like this: https://generatepress.com/forums/topic/replace-default-post-category-template-with-a-blank-page-template/#post-608201
December 31, 2018 at 3:47 am #769711FernandoOption 1 definitely doesn’t.
Option 2 I thank you, but I don’t understand it.How can I show a blank page in the template of the categories?
Another option is to give a better style to the blog entries. Since we don’t like a lot of people… š
December 31, 2018 at 8:37 am #769990TomLead DeveloperLead DeveloperBasically, you would add this function to your site:
add_filter('request', function(array $query_vars) { // do nothing in wp-admin if (is_admin() ) { return $query_vars; } // if the query is for a category if ( isset( $query_vars['category_name'] ) ) { // save the slug $pagename = $query_vars['category_name']; // completely replace the query with a page query $query_vars = array( 'pagename' => "$pagename" ); } return $query_vars; } );
What this does is check the category name being requested, and redirects you to the page with that name.
So if I’m landing on
mywebsite.com/category/test-category
, it will redirect me tomywebsite.com/test-category
.January 17, 2019 at 4:55 am #784479FernandoHi Tom,
This isn’t working. Besides, I don’t want to redirect to pages with the same name.
I have a design (made with Elementor) which I insert as a Hook in āElementsā. This replaces the style of the category, inserting the template that I have made in Elementor.
The problem is that the posts of each category are still shown, so what I have to do is hide them by CSS, but I wish they could be hidden in another way…I know this is complicated, but it wouldn’t be necessary if the category entries could be edited in GeneratePress as Elementor pages to give it a better style.
January 17, 2019 at 8:35 am #784774DavidStaffCustomer SupportHi there,
if you have Elementor Pro then you can build the Archive Templates with that and it will replace the GP Archives. Alternatively if you can share a link to your site we can have a look to see if its easy enough to replicate in GP.
-
AuthorPosts
- You must be logged in to reply to this topic.