[Resolved] Custom Category Page Content

Home Forums Support Custom Category Page Content

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #302659
    Tony

    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!

    Check out my Detroit-centered audio tours
    at AudioDTours.com

    #302813
    Tom
    Lead Developer
    Lead Developer

    Hi 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!

    #302858
    Tony

    Top level http://www.mrhardware.com/category/articles-and-videos/

    Second level http://www.mrhardware.com/category/articles-and-videos/clogged-drains/

    Thanks

    Check out my Detroit-centered audio tours
    at AudioDTours.com

    #303225
    Tom
    Lead Developer
    Lead Developer

    Hmm, 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.

    #303476
    Tony

    I 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

    Check out my Detroit-centered audio tours
    at AudioDTours.com

    #303581
    Tom
    Lead Developer
    Lead Developer

    I 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..

    #303595
    Tony

    I 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

    Check out my Detroit-centered audio tours
    at AudioDTours.com

    #303698
    Tom
    Lead Developer
    Lead Developer

    Ah, 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 🙂

    #303735
    Tony

    Ahh, 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!

    Check out my Detroit-centered audio tours
    at AudioDTours.com

    #303885
    Tom
    Lead Developer
    Lead Developer
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.