- This topic has 9 replies, 2 voices, and was last updated 7 years ago by Tom.
-
AuthorPosts
-
April 6, 2017 at 12:14 pm #302659Tony
I’m digging GP Premium! Just ran into a brick wall, though. In the content area of my category archive pages, I wish to only show a list of posts in that sub-category. Also, in the top level category archive, I need to see only excerpts of the last 5 posts. I’ll need to precede the lists and excerpts with a short description and possibly an image. I just have one top-level category and about 22 second-level categories.
Haven’t found a way to change the default content in the ‘content’ area of category archive pages within GP. I have Elementor installed also but can’t find a way to utilize it for this, either.
Thanks!
April 6, 2017 at 11:04 pm #302813TomLead DeveloperLead DeveloperHi there,
I wish to only show a list of posts in that sub-category
Not too sure what you mean? Archive/category pages will only display the posts that belong inside that category.
Any chance you can show me an example of what you’re trying to do with the posts? Having a tough time imagining it.
Thanks!
April 7, 2017 at 1:42 am #302858TonyApril 7, 2017 at 6:17 pm #303225TomLead DeveloperLead DeveloperHmm, in order to change the layout of your posts that drastically on a second level archive, you would need some custom coding.
For example: http://wordpress.stackexchange.com/questions/19038/different-template-for-first-and-second-level-custom-post-page
So basically you would need to create a custom page template in your child theme, and then apply some logic like that so different elements display depending on their level.
April 8, 2017 at 1:16 pm #303476TonyI get where you’re coming from but there’s a lot of assumed background to understand that post. I’m a bit more simple-minded than all that!
Now I’m thinking I can just use Elementor to make the top-level category page and use a shortcode to display the 5 or 6 truncated recent posts in the content area. But, for all other sub-cat pages, I still need a way to show only the post titles in the content area instead of title, author, excerpt, “in category etc.” I suppose I can use CSS to ‘display:none’ of all elements except title and then add formatting, but I’m concerned that screws load time. Let’s say there’s 24 posts in a certain sub category. I assume it would load all the info (title, author, excerpt, etc.) for each first, then hide it.
That said, I’m not against adding a little code to some template page. But my puny brain needs to be told exactly which page and pretty much spoon-fed the code. I already made a bare-bones child theme. Looking at archive.php gives me a clue but I don’t think that’s the page I’d copy. What I see in there is this:
<?php do_action( 'generate_archive_title' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php /* Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?>
It seems I need to make a php file (let’s say, named content-titlesonly.php) but I have no idea where I copy the code from that goes in it. I’m guessing from there I would just delete all code within a loop that refers to anything but the title. Am I on the right track?
Thanks – T
April 8, 2017 at 10:38 pm #303581TomLead DeveloperLead DeveloperI think it might be better to go with the Elementor post widget or a plugin like WP Show Posts.
They won’t take over your current category/archive pages, but they will give you way more control over what you can do with your posts on static pages.
The other method gets super complicated when it comes to telling how deep we are within categories etc..
April 9, 2017 at 1:44 am #303595TonyI apologize for not being clear. I no longer need it to recognize what level, since I’m handling the top level with a static Elementor page. All category pages can behave exactly as they normally do except all I want to see in the content area are titles instead of titles with author, excerpt, etc.
What I can’t figure out is which php file do I copy into my child theme (the one that controls category pages) and what do I name it?
Thanks again! ~ T
April 9, 2017 at 9:08 am #303698TomLead DeveloperLead DeveloperAh, you can turn off mostly everything in “Customize > Blog > Blog Content” using the Blog add-on.
Removing the excerpts should be do-able by setting the excerpt length to 0.
Let me know ๐
April 9, 2017 at 10:35 am #303735TonyAhh, good. Getting close, but I want to see the author on the post page.
So, I can leave only the author but remove it (and the residual “…” remaining from the empty ‘Read more’ line) with CSS. I’ll just precede the selectors with ‘.archive ‘ and that leaves the posts alone. Not a perfect solution but it works!
Now on to more developing/tweaking so I can bug you again in another post!
Thanks again, Tom!
April 9, 2017 at 9:28 pm #303885TomLead DeveloperLead DeveloperNo problem! ๐
-
AuthorPosts
- You must be logged in to reply to this topic.