Viewing 6 replies - 1 through 6 (of 6 total)
  • independent of the theme, a query and loop for what you want, would be something like:

    https://codex.www.ads-software.com/Class_Reference/WP_Query

    <?php $args = array(
    'posts_per_page' =>4,
    'cat' => 4,
    'order' => 'DESC',
    'orderby' => 'date'
    );
    $loop = new WP_Query( $args );
    if( $loop->have_posts() ) :
    single_cat_title();
    while( $loop->have_posts() ) : $loop->the_post();
    the_title();
    endwhile;
    endif;
    wp_reset_postdata(); ?>

    (no html included, not tested)

    display in two columns is more a CSS problem.

    Thread Starter blondieblue227

    (@blondieblue227)

    didn’t work

    do i need to do this?

    /* Include the Post-Format-specific template for the content.
    					 * If you want to overload this in a child theme then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */

    i pasted your loop code in index.php inplace of

    /* Include the Post-Format-specific template for the content.
    					 * If you want to overload 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-list, get_post_format() );
    				?>
    
    			<?php endwhile; ?>

    P.S. i only want posts listed by categories on the front page.

    Thread Starter blondieblue227

    (@blondieblue227)

    in my themes expound folder i made another folder called expound-child in it is a file content_list.php with the code of

    /*
    Theme Name: Expound
    Author: Konstantin Kovshenin
    Author URI: https://kovshenin.com
    Description: An awesome magazine theme for your WordPress site. Responsive layout, post thumbnails support, featured posts, an easy-to-use social menu and much more.
    Version: 2.0.1
    License: GNU General Public License
    License URI: license.txt
    Tags: black, blue, white, light, one-column, two-columns, right-sidebar, editor-style, responsive-layout, custom-header, flexible-header, custom-background, featured-images, custom-menu, post-formats, sticky-post, threaded-comments, translation-ready, full-width-template, buddypress
    
    This theme, like WordPress, is licensed under the GPL.
    
    Expound is based on Underscores https://underscores.me/, (C) 2012-2013 Automattic, Inc.
    */
    
    /* =Imports styles from the parent theme
    ----------------------------------------------------*/
    @import url(‘https://www.ivykennedy.com/home2/wp-content/themes/expound/expound-child/content-list.php')
    
    /* =Theme customization starts here
    <?php $args = array(
    'posts_per_page' =>4,
    'cat' => 4,
    'order' => 'DESC',
    'orderby' => 'date'
    );
    $loop = new WP_Query( $args );
    if( $loop->have_posts() ) :
    single_cat_title();
    while( $loop->have_posts() ) : $loop->the_post();
    the_title();
    endwhile;
    endif;
    wp_reset_postdata(); ?><?php $args = array(
    'posts_per_page' =>4,
    'cat' => 4,
    'order' => 'DESC',
    'orderby' => 'date'
    );
    $loop = new WP_Query( $args );
    if( $loop->have_posts() ) :
    single_cat_title();
    while( $loop->have_posts() ) : $loop->the_post();
    the_title();
    endwhile;
    endif;
    wp_reset_postdata(); ?>

    Thread Starter blondieblue227

    (@blondieblue227)

    with this code:

    <?php if ( have_posts() ) : ?>
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php
    
    					get_template_part( 'content_list.php', get_post_format() );
    				?>
    
    			<?php endwhile; ?>

    it’s blank to the left of the sidebar now.
    before it continued to list my posts.
    it’s also blank when i click on a category under my banner. before it was listing posts.
    i’m switching it back for now.

    Thread Starter blondieblue227

    (@blondieblue227)

    am i on the right track?
    i created a custom page template, i’m planing to add the loop code to this template, then set the this page as my static home page.

    Thread Starter blondieblue227

    (@blondieblue227)

    done.

    used WEN’s Responsive Column Layout Shortcodes
    and
    List category posts

    https://www.ads-software.com/support/topic/featured-categories-widget?replies=2

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘loop to display posts in categories’ is closed to new replies.