Site logo

[Support request] Display posts as list on category page

Home Forums Support [Support request] Display posts as list on category page

Home Forums Support Display posts as list on category page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1539564
    Ayoosh

    I am working on customizing few options on my site and like to customize the category page to show the posts and numbered lists ( I don’t have any image and other stuff), here is how I might want to display the data on category page.

    possible layout
    https://pasteboard.co/JBjPmQG.png

    How can I do that without impacting any other page

    #1539833
    David
    Staff
    Customer Support

    Hi there,

    you would need to use the option_generate_blog_settings filter to disable the elements you don’t require:

    https://docs.generatepress.com/article/option_generate_blog_settings/

    Heres an example PHP Snippet that disables some elements on the category archives:

    add_filter( 'option_generate_blog_settings', 'db_custom_category_archive' );
    function db_custom_category_archive( $options ) {
        if ( is_category() ) {
            $options['read_more_button'] = false;
            $options['date'] = false;
            $options['categories'] = false;
            $options['tags'] = false;
            $options['post_image'] = false;
            $options['column_layout'] = false;
            $options['featured_column'] = false;
            $options['masonry'] = false;
        }
        return $options;
    }
    #1540185
    Ayoosh

    Thanks for your response David, I do have following questions

    1. With this hook , I am still seeing the excerpt in the category page. I am assuming this is because of the standard WordPress if we manually adding excerpt to our posts.

    2. I still don’t see this as an ordered list, is there a way I can work on the CSS using premium options? Current category page layout have too much space and all I need is a ordered list.

    Note: I have removed the excerpt using the standard WP hook

    You can check layout at https://staging.javadevjournal.com/category/spring-security/

    Thanks
    Ayoosh

    #1540193
    David
    Staff
    Customer Support

    So first off to remove the Excerpt, apply the PHP Snippet provided here:

    https://docs.generatepress.com/article/excerpt_length/

    Then add this CSS to display the Counter:

    .archive.category .site-main {
        counter-reset: section;
    }
    .archive.category .site-main article h2:before {
        counter-increment: section;
        content: counter(section) '. ';
    }
    
    .archive.category .entry-summary,
    .archive.category .entry-meta {
        display: none;
    }
    
    /*** Optional ***/
    /* remove padding from article */
    .archive.category .site-main article .inside-article {
        padding-top: 0;
        padding-bottom: 0;
    }
    /* Change the font size */
    .archive.category .site-main article h2 {
        font-size: 24px;
    }

    I have included some optional CSS to style the article and post title if you need to.

    #1540228
    Ayoosh

    Hey David,

    Thanks for your quick and wonderful response, I am able to fix most of the issue and layout is very close to what I was thinking 🙂

    #1540854
    David
    Staff
    Customer Support

    Thats great! – Glad to be of help

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.