Skip to:
Content
Pages
Categories
Search
Top
Bottom

Recent Posts Without Shortcode [resolved]

  • @hitkid

    Participant

    Hi guys, I’m having trouble showing the shortcode for recent posts on my home page after I entered in code to get my recent blog posts to show up on my home page.

    Here is the code I used for recent posts:

    $args = array( 'numberposts' => 3 );
    $lastposts = get_posts( $args );
    foreach($lastposts as $post) : setup_postdata($post); ?>
    	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_content(); ?>
    <?php endforeach; ?>

    I saw in another topic how to get 10 recent topics on your home page with shortcode, but it didn’t work after the above code. Could someone please help me with the code to get 10 recent topics to appear on my home page?

    Using the current versions of wordpress, bbpress and buddypress. Working with a buddypress default child theme. I’m also newer to php, so go easy please 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • @hitkid

    Participant

    Sorry I meant to say recent topics.

    @hitkid

    Participant

    Found it in the old bbpress twenty ten theme. Here it is for anyone who wants it.

    Insert this into your template where you want it.

      <?php do_action( 'bbp_template_notices' ); ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<div id="topics-front" class="bbp-topics-front">
    						
    						<div class="entry-content">
    
    							<?php the_content(); ?>
    
    							<?php bbp_get_template_part( 'content', 'archive-topic' ); ?>
    
    						</div>
    					</div><!-- #topics-front -->
    
    				<?php endwhile; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar