• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

List of Post Titles in Category View

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › List of Post Titles in Category View

This topic is: not resolved

Tagged: category archive, posts_per_page, pre_get_posts

  • This topic has 11 replies, 3 voices, and was last updated 8 years, 8 months ago by stevenrmoody.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • September 9, 2016 at 11:42 am #192904
    stevenrmoody
    Participant

    I'm using a minimal Child Theme with the framework for both my own site (Snake vs Crane) and a site at UC Berkeley which is for documentation.

    I find that the "out of the box" category and search results is hard to read for users.

    I've found instructions on how to filter out various elements of the post (content, metadata) but these approaches all result in (at least) each title in a separate box.

    What I want is one box with all the titles of the results as a link, styled to they are not huge h1 headlines.

    An article HERE: http://www.tilcode.com/wordpress-genesis-framework-showing-a-list-of-post-titles-in-category-view/ shares some code which ALMOST gives me what I want.

    I tried the code on both of my sites.

    On my martial arts site, the loop seems to have stopped after delivering only three or four titles. I could display a category that had 60 titles but only four would appear (all styles right because I styled the .category-post-title-list and added the container color and resized the font, etc).

    On the documentation site for UCB, it stopped after one entry (that site is on Pantheon FYI). You can see that here by clicking on the categories on the sidebar: Asktico

    This result is SO tantalizing, because if it would deliver ALL the results for the category, then it would be exactly what I want.

    My other question is -- how can I do the SAME THING, but with the search results?

    For documentation, users want to be able to quickly see the titles of the results, as "all at once" as possible. So one box, with a list of clickable titles would be perfect. So this code is so close to what I need! I just need a little help to take one more step in the right direction!

    I would greatly appreciate any help!

    Steve

    http://dev-wpasktico.pantheon.berkeley.edu/
    September 9, 2016 at 11:46 am #192905
    Brad Dalton
    Participant

    Remove the loop and add a new WP_Query to a archive.php file or any file which uses the WordPress Template Hierarchy.


    Tutorials for StudioPress Themes.

    September 9, 2016 at 11:53 am #192906
    sgoerger
    Member

    At first glance the code you linked seems just like what you would want, and the nature of the error you describe (not right # of posts) is just weird. I can't think of what would interfere for you...

    If I were working on this I would get that code in there, and then take a look at error logs, dev tools console, inspect the source code, etc, to try and diagnose why this isn't working as expected...

    September 9, 2016 at 12:28 pm #192910
    Brad Dalton
    Participant

    Based on your code, the WordPress Reading settings control posts per page on archives however you can override using the following:

    $query->set( 'posts_per_page', '-1' );

    In a pre_get_posts function which is what you linked to.


    Tutorials for StudioPress Themes.

    September 9, 2016 at 12:58 pm #192911
    stevenrmoody
    Participant

    Thank you!

    I reset my Reading Settings to 100 and I got the results I wanted!

    Of course, now the search results are lengthy strings of separate boxes.

    Next step, figure out how to get the same results I'm getting from categories in my search results!

    thanks again!

    September 9, 2016 at 1:24 pm #192912
    Brad Dalton
    Participant

    Modify this line in the code

    if( $query->is_main_query() && $query->is_category() || $query->is_search() ) {
    

    Tutorials for StudioPress Themes.

    September 9, 2016 at 2:34 pm #192915
    stevenrmoody
    Participant

    In the code of search.php (in my Child Theme)?

    thanks!

    Steve

    September 9, 2016 at 2:38 pm #192917
    stevenrmoody
    Participant

    Currently search.php has this in it:

    <?php

    add_action( 'genesis_before_loop', 'genesis_do_search_title' );

    function genesis_do_search_title() {

    $title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s %s</h1></div>', apply_filters( 'genesis_search_title_text', __( 'Search Results for:', 'genesis' ) ), get_search_query() );

    echo apply_filters( 'genesis_search_title_output', $title ) . "\n";
    }

    genesis();

    [\php]

    September 9, 2016 at 2:44 pm #192918
    Brad Dalton
    Participant

    In the code you linked to now becomes this:

    https://gist.githubusercontent.com/braddalton/5a699631b860b7d8f45901c48b9a2335/raw/9904019a0350a2f6f6694b99e73354a9fefd8d6a/functions.php


    Tutorials for StudioPress Themes.

    September 9, 2016 at 2:46 pm #192919
    stevenrmoody
    Participant

    Oh - I fixed that with your suggestion to modify my Reading Settings -- I upped the number (from 1) to 100 and I got the results I was looking for.

    Thanks again.

    September 9, 2016 at 2:52 pm #192920
    Brad Dalton
    Participant

    This code modification relates to your search page https://gist.github.com/braddalton/5a699631b860b7d8f45901c48b9a2335

    Your 2nd Question:

    Of course, now the search results are lengthy strings of separate boxes.Next step, figure out how to get the same results I'm getting from categories in my search results!


    Tutorials for StudioPress Themes.

    September 9, 2016 at 3:07 pm #192922
    stevenrmoody
    Participant

    Sorry - I think I am not communicating well!

    What I am looking for is to do a search using the search widget in the upper-right of the header and get results like what I am now getting in the results from "All Content" and (now) all of my links to the various categories -- that is, a list of post links all in one box.

    Thanks for your assistance and sorry if I am not being clear.

    Steve

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble