Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How would I include a post from a specific category on my homepage in buddypress?

Example I have a category 'Homepage Banners' with an ID of 3.

In the admin I create a post and assign the 'Homepage Banners' category to it.

I then need this to show up on the homepage (the latest post).

I am new to WP/BP, any help appreciated.

Thanks.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You can also use a new query (with php enabled) so show a single post by ID, i.e. the post with ID 101:

<?php $my_query = new WP_Query('p=101'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?><?php the_content(); ?></a>
<?php endwhile; ?>

This can be used multiple times inside the WP loop without conflict.

Use Exec-PHP « WordPress Plugins or others.

share|improve this answer

Thanks to Simon Forster:

I had to slightly edit your code to end up with:

global $wp_query;

$args = array('cat'=>3,'posts_per_page'=>1);
$my_query = new WP_Query($args);
while($my_query->have_posts()):
    $my_query->the_post();
    the_title();
    the_content();
endwhile;

Thanks for the help :)

share|improve this answer

You could use the inline posts plugin http://aralbalkan.com/wordpress

Or a plugin called ggis-InlinePost (http://wordpress.org/extend/plugins/ggis-inline-post/) gives authors an easy way to insert a post within a page or another post. Simply add [ggisinlinepost id=”%id”] to your post. There are a few attributes to control the display of the inlined post’s title, content, metadata, and separators.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.