-
AuthorPosts
-
January 13, 2017 at 6:23 pm #733275
Hi,
I have another question: I try to setup a category template for the category “Allgemein”, named category-allgemein.php. Instead of showing all related Posts for this category it should show me a single post (just like you can set a single page to be shown at the homepage). I tried different things but it doesn’t work. Can you help me ?
I guess I have to implement a conditional tag (is_single) and remove the code which manages to show the related posts. But i can#T identify the code snippet, either in the category.php nor in the category-template.php. (I’m a newbie in PHP, so have patience please ;)
Greets,
DanielJanuary 17, 2017 at 2:08 pm #734712Hey ralfbelusa,
in your single.php file you should find
//show related posts if there are any get_template_part( 'includes/related-posts');
Replace this by
/*show related posts if there are any get_template_part( 'includes/related-posts');*/
Let me know if it works :)
Best regards,
AndyJanuary 18, 2017 at 12:26 pm #735270Hey Andy,
thanks for your quick help! I didn’t try it yet, but for my understanding: your proposal will make the PHP-code, which manages to show the related posts, to a comment, right? so the related posts won’t appear anymore. That’s a good first step ;) but how can I define that a single page or post is shown instead?Greets,
DanielJanuary 18, 2017 at 11:32 pm #735602Hi,
what do you mean? did you try the code? and are the related posts disappearing fine?
Best regards,
AndyJanuary 24, 2017 at 10:56 am #737658Hey Andy,
i can only find this tag in the single.php://show related posts based on tags if there are any
get_template_part( ‘includes/related-posts’);And I wonder why we’re talking about the single.php and not the category.php. Maybe I have to address the issue more precisely:
Instead of showing a standard category page with related posts, I like to build the content of the pages more individual. So i have to remove the related posts tag at a first step. Furthermore, I think I have to create different category.php docs like “category-shoes.php” for the “shoes” category. There I remove the “related posts” tag and implement a php tag like “is-shown” or something else to address directly the name of the page/post i like to show.
Is it clearer now?
Thanks for your help.
DanielJanuary 26, 2017 at 5:13 pm #739043Hi,
we’re not talking about a theme related issue anymore, but about general WordPress customization. So refer to this for more information about it:
http://www.wpbeginner.com/wp-themes/how-to-create-category-templates-in-wordpress/
https://codex.wordpress.org/Category_TemplatesBest regards,
AndyJanuary 27, 2017 at 12:57 pm #739347Hey Andy,
I guess it is a theme related issue because I did what is described in your links but exactly that doesn’t work…
I just need to know which file is responsible for the categories and where I can find this “related posts” thing (not in the single.php, not in the category.php nor in the archive.php; where??? > this is theme related). I don’t know… please help!I’m using such a category-template right now for the category “Allgemein”, which means I created a category-allgemein.php file with the Code from the category.php. Then I changed some code but nothing happened. When I delete everything, nothing happens. So it seems like it doesn’t work, but i don’t know why!?
Greets,
DanielJanuary 27, 2017 at 8:34 pm #739557Hi,
Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)
However, would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :). We might be able to provide you some simple CSS code to hide your related posts in question.
Best regards,
Andy -
AuthorPosts
- You must be logged in to reply to this topic.