Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Making User Blogs Part of the Main Theme

I guess that would work. Seems like a very round about method however and you’re creating lots of blogs and database tables and such that you don’t need if all you want to do is have only YOUR posts show up on the homepage. It that’s the goal… just your posts on the homepage (and it sounds like that based on your last post)… then this is very simple. The solution is already above. Just add that query before the WordPress loop on your home.php file. So simple:

<?php query_posts('author=1'); ?>

and reset the query at the end of the loop:

<?php wp_reset_query(); ?>

This assumes that your admin account had an author ID of 1… which is safe to assume.

Here is a slightly more complete example. But really… this is an extremely simple loop. You’ll probably want more stuff in there… like tags, dates, categories, etc. But this loop will work to show only posts by author ID 1. I just figured it would be good to see what I’m talking about in more context.

<!-- custom query -->
<?php query_posts('author=1'); ?>

<!-- the loop -->
<?php if (have_posts()): while (have_posts()): the_post(); ?>
<h3><?php the_title(); ?></h3>
<p><?php the_content(); ?></p>
<?php endwhile; else: ?>
<p>No posts.</p>
<?php endif; ?>

<!-- reset the query -->
<?php wp_reset_query(); ?>

Skip to toolbar