• Hey everyone!

    I’d love some help with this question. I’m running the socha theme and as a footer option for the Home Page, you can choose for it show a listing of ‘Recent Posts’. Problem is, the default is for it to only show Blog Posts, but I’ve created custom post types like ‘Reviews’ and ‘Insights’ that I would like to include in the Recent Posts feed.

    I’ve searched around a ton and I think I’ve narrowed down the file I should be editing called home_blogposts.php in the themes folder. Any idea what I should add to the code to get my desired results? These are the contents of the .php file:

    <div class=”recentgalleriesbox gallerygrid cf”>
    <div class=”galleriestitle”>
    <?php _e(‘Recent Posts’, ‘aletheme’)?>
    </div>
    <div id=”galcontainer” class=”blogpost recentgaleriesitems cf”>
    <?php
    if(ale_get_meta(‘showcathome’)) { $postscatshow = ‘&cat=’.ale_get_meta(‘showcathome’);} else {$postscatshow =”;}
    if(ale_get_meta(‘shownumpostshome’)) { $postperpagenum = ‘&posts_per_page=’.ale_get_meta(‘shownumpostshome’);} else { $postperpagenum = ‘&posts_per_page=-1’; }
    query_posts(‘&post_type=post’.$postperpagenum.$postscatshow);
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class=”itemblog”>
    <?php
    if (has_post_format(‘gallery’)){

    include ‘blog_gallery.php’;

    } elseif(has_post_format(‘image’)) {

    include ‘blog_image.php’;

    } elseif(has_post_format(‘quote’)) {

    include ‘blog_quote.php’;

    } elseif(has_post_format(‘video’)) {

    include ‘blog_video.php’;

    } else {

    include ‘blog_standart.php’;

    } ?>
    </div>
    <?php endwhile; else: ?>
    <?php ale_part(‘notfound’)?>
    <?php endif; ?>
    </div>
    </div>

Viewing 1 replies (of 1 total)
  • Thread Starter thegaysabroad

    (@thegaysabroad)

    Oops. Showing my newb colours.

    Is this better?

    <div class="recentgalleriesbox gallerygrid cf">
        <div class="galleriestitle">
            <?php _e('Recent Posts', 'aletheme')?>
        </div>
        <div id="galcontainer" class="blogpost recentgaleriesitems cf">
            <?php
            if(ale_get_meta('showcathome')) { $postscatshow = '&cat='.ale_get_meta('showcathome');} else {$postscatshow ='';}
            if(ale_get_meta('shownumpostshome')) { $postperpagenum = '&posts_per_page='.ale_get_meta('shownumpostshome');} else { $postperpagenum = '&posts_per_page=-1'; }
            query_posts('&post_type=post'.$postperpagenum.$postscatshow);
            if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div class="itemblog">
                    <?php
                    if (has_post_format('gallery')){
    
                        include 'blog_gallery.php';
    
                    } elseif(has_post_format('image')) {
    
                        include 'blog_image.php';
    
                    } elseif(has_post_format('quote')) {
    
                        include 'blog_quote.php';
    
                    } elseif(has_post_format('video')) {
    
                        include 'blog_video.php';
    
                    } else {
    
                        include 'blog_standart.php';
    
                    } ?>
                </div>
            <?php endwhile; else: ?>
                <?php ale_part('notfound')?>
            <?php endif; ?>
        </div>
    </div>
Viewing 1 replies (of 1 total)
  • The topic ‘Include Custom Post Type in 'Recent Posts'’ is closed to new replies.