WordPress.org

Forums

Making an "all posts" category??? (4 posts)

  1. Shauray
    Member
    Posted 4 years ago #

    I'm currently using the "Church theme" by studiopress, and on my website, theres options to show latest posts from three categories on the home page (left block, right block, and bottom block). On the bottom block, I want to show all recent posts, not just from a specific category.

    Either I:
    1. Somehow make a category that contains all posts.
    or
    2. Edit the home template.

    Here's my code for that block in home.php:

    <div id="homepagebottom">
    
    			<div class="hpbottom">
    
    <h3><?php echo cat_id_to_name(get_theme_mod('featured_bottom')); ?></h3>
    
    				<?php $recent = new WP_Query("cat=".get_theme_mod('featured_bottom')."&showposts=".get_theme_mod('featured_bottom_num')); while($recent->have_posts()) : $recent->the_post();?>
    				<?php if( get_post_meta($post->ID, "thumb", true) ): ?>
    
    				<a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=<?php echo get_theme_mod('featured_bottom_thumb_height'); ?>&w=<?php echo get_theme_mod('featured_bottom_thumb_width'); ?>&zc=1" alt="<?php the_title(); ?>" /></a>
    				<?php else: ?>
    				<?php endif; ?>				
    
                    <strong><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></strong>
    				<?php the_content_limit(350, __("[Read more of this review]", 'studiopress')); ?>
    
    				<hr/>
    
    				<?php endwhile; ?>
    
    				<?php $cat = get_category(get_theme_mod('featured_bottom')); ?>
    				<strong><a href="<?php echo get_category_link(get_theme_mod('featured_bottom')); ?>" rel="bookmark"><?php echo __("Read More Posts From ", 'studiopress')." ".$cat->name; ?></a></strong>
    
    			</div>
    
    		</div>
    
    	</div>

    Help is greatly appreciated! Thanks!

  2. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    You'll probably get the most relevant answer for how to achieve this with your theme on the studiopress forum - that's partly what you paid for when you bought the theme.

  3. alchymyth
    Forum Moderator
    Posted 4 years ago #

    try to use "cat=0&showposts.... in this line:

    <?php $recent = new WP_Query("cat=".get_theme_mod('featured_bottom')."&showposts=".get_theme_mod('featured_bottom_num')); while($recent->have_posts()) : $recent->the_post();?>

    but then you will run into the issue of duplicate posts ...

  4. Shauray
    Member
    Posted 4 years ago #

    @alchymyth, thanks, it shows my latest posts with a few undesirable things, but is there any way i can just make a category with the latest posts in order? That would be the most effective

Topic Closed

This topic has been closed to new replies.

About this Topic