I am making a wordpress twenty seventeen child theme. In this theme I have a archive page for all posts with the category "all". Every post has a sub category. On the archive page all posts are showed like this: screenshot of archive page content. Now if i click one of the posts and go to a single post page it shows the post like this: screenshot of single post page. Is there a way of organizing the posts so that i would be able to edit them based on the sub category.
-
you mean, you want separate template view for subcategories post?– 1naveengiriCommented Feb 5, 2018 at 9:29
-
your title seems single page showing archive template is your problem. so for that we have single.php(single page template) and archive.php(archive page temp). did you checked and tried editing single.php template file?– 1naveengiriCommented Feb 5, 2018 at 9:34
-
@1naveengiri no i want it so that when i click a post on the archive page it shows me all the content of that one post and that i can give it a different styling.– randomtardis42Commented Feb 5, 2018 at 9:38
-
I am wondering if you aware of WordPress template structure. developer.wordpress.org/themes/template-files-section/… developer.wordpress.org/themes/basics/template-hierarchy if not so you have archive.php for your archive pages of post and category. you have single.php for your every WordPress single post. you can adjust your single.php code to make single page HTML different then archive page.– 1naveengiriCommented Feb 5, 2018 at 9:47
-
@1naveengiri I am aware of this but the main problem is that it will take the styling i have given to the "category-all" tag when i go to a single page– randomtardis42Commented Feb 5, 2018 at 10:00
1 Answer
if you are not aware of WordPress template structure.
https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/
https://developer.wordpress.org/themes/basics/template-hierarchy/
WordPress follow a hierarchy for post/page templates archive.php for your archive pages of post and category.
single.php for your every WordPress single post. you can adjust your single.php code to make single page HTML different then archive page.
In your case to separate styling for the same HTML of single and archive page, why not your style archive and single page separate by taking body classes as a parent? your attribute will have different class on single and archive page