WordPress.org

Ready to get started?Download WordPress

Forums

Changing default loop to excerpt only within theme (1 post)

  1. jkoop814@gmail.com
    Member
    Posted 11 months ago #

    So I have been trying to figure this out for way to long. I've googled all over and haven't been able to get things working the way I'd like. I am using the Genesis Framework and the Dynamik child theme. I have a custom post type called "publications" created with the plugin "Types". What I'm looking to do is have the default loop on the home page and the posts on the "Publications page" display excerpts instead of the full post. I currently have a custom loop added in the home.php file.

    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'custom_loop');
    
    function custom_loop() {
        $arg = array(
                'post_type' => 'Publications', // this can be an array : array('guide','guide1',...)
                'posts_per_page' => 6,
                'order' => 'DESC',
                // 'category_name' => 6
                'post_status' => 'publish'
                );
        $query = new WP_Query($arg);
        if ( $query->have_posts() ) :
            while ( $query->have_posts() ) : $query->the_post();
            ?>
                <article>
                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    		<div class="post-info"><?php the_excerpt(); ?></div>
                    <div class="entry-content"><?php the_excerpt(); ?></div>
                </article>
            <?php
            endwhile;
        endif;
        wp_reset_query(); 
    
    }

    Problem is that this only effects the home page and not the Publications page. If I do anything in the functions.php it seems to overwrite everything that is on other pages with the loop. I've read that to change the default loop I need to change "the_content" to "the_excerpt" in the index.php file. This theme doesn't have that file so I'm at a loss.

    I realize this may be Genesis/Dynamik related so I do have a query with them as well, thought I would see if someone here had some ideas though.

    Website is http://eppc.polymath.io/

    Appreciate any help.

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 11 months ago by jkoop814@gmail.com
  • This topic is not resolved
  • WordPress version: 3.5.1