• Hello,

    I would like to create a page “leisure” and display on it all the articles in list who have the category leisure and do the same for an other page named “talk” and display only the articles in list with this category ? Does anyone have an idea ?

    Ideally I would like only a display list of the articles (image, date, text) but no links on it to go to the article itself.

    Thanks for your help

Viewing 1 replies (of 1 total)
  • Theme Author Bishal Napit

    (@mebishalnapit)

    @cora06

    It looks like you are trying to display the content too in the archive, search and blog pages, right? If yes, then, you can duplicate the file ‘template-parts/content.php’ in your child theme. In this file you will find the below code:

    <div class="entry-content">
        <?php
        if (is_single()) :
            the_content();
        else :
            if (is_sticky()) :
                // displaying full content for the sticky post
                the_content(sprintf(
                    /* translators: %s: Name of current post. */
                    wp_kses('<button type="button" class="btn btn-primary continue-more-link">' . __('Read More <i class="fa fa-arrow-circle-o-right"></i>', 'creative-blog') . '</button> %s', array('span' => array('class' => array()), 'i' => array('class' => array()), 'button' => array('class' => array(), 'type' => array()))), the_title('<span class="screen-reader-text">', '</span>', false)
                ));
            else :
                the_excerpt(); // displaying excerpt for the archive pages
            endif;
        endif;
        ?>
    
        <?php
        wp_link_pages(array(
            'before' => '<div class="page-links">' . esc_html__('Pages:', 'creative-blog'),
            'after' => '</div>',
        ));
        ?>
    </div><!-- .entry-content -->

    Now, you just need to change the above code with the below one and check:

    <div class="entry-content">
        <?php
        the_content(sprintf(
            /* translators: %s: Name of current post. */
            wp_kses('<button type="button" class="btn btn-primary continue-more-link">' . __('Read More <i class="fa fa-arrow-circle-o-right"></i>', 'creative-blog') . '</button> %s', array('span' => array('class' => array()), 'i' => array('class' => array()), 'button' => array('class' => array(), 'type' => array()))), the_title('<span class="screen-reader-text">', '</span>', false)
        ));
        ?>
        <?php
        wp_link_pages(array(
            'before' => '<div class="page-links">' . esc_html__('Pages:', 'creative-blog'),
            'after' => '</div>',
        ));
        ?>
    </div><!-- .entry-content -->

    And for the title not linking to the respective posts, you will find the code below too in that file:

    <?php
    if (is_single()) :
       the_title('<h1 class="entry-title">', '</h1>');
    else :
       the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
    endif;
    ?>

    which needs to be replaced by the below code:

    <?php
    if (is_single()) :
       the_title('<h1 class="entry-title">', '</h1>');
    else :
       the_title(sprintf('<h2 class="entry-title">, '</h2>');
    endif;
    ?>

    Thanks.

    Regards.
    Bishal Napit

Viewing 1 replies (of 1 total)
  • The topic ‘article display in list depends on the category’ is closed to new replies.