Anyone have an idea what the PHP for this would be?
Anyone have an idea what the PHP for this would be?
query_posts('category_name=Staff Home');
or you can use the ID.
Thanks for trying to help, I appreciate the effort, but that's not enough information.
You will see in the sidebar their are 2 sections. I need to be able to have posts from their respective categories to appear.
I tried this:
<ul>
<?php query_posts("category_id=6&orderby=desc&showposts=4"); ?>
<?php while (have_posts()) : the_post(); ?>
<li><?php the_time('F j, Y'); ?><br /><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
It made the actual page content wonky. It is displaying a post rather then the page content.
First. You can call the category by cat=6 rather than category_id=6.
If you are doing additional queries beyond the main loop on the page then you can use this:
<?php
$latestPosts = new WP_Query();
$latestPosts->query('cat=6&showposts=4');
while ($latestPosts->have_posts()) : $latestPosts->the_post();
?>
...do your li display thing here...
<?php endwhile; ?>
...and then a second time for the next loop.
You, my dear, are brilliant! Assistance on these forums is usually non-existent, so your help is much appreciated! I'm definitely no PHP expert. ;)
Your welcome. I "wish" I was brilliant!
What about links?
Tried this and was unsuccessful:
<ul>
<?php
$bookmarks = new WP_Query();
$bookmarks->query('cat=15');
$bookmarks = get_bookmarks("cat=15");
if ($bookmarks[0] != '') { ?>
<?php
foreach ( $bookmarks as $bookmark ) {
?>
<li><a href="<?php echo clean_url($bookmark->link_url); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" target="_blank"><?php echo $bookmark->link_name; ?></a></li>
<?php endwhile; ?>
</ul>Nevermind! Got it worked out! :)
Looks like there's a mistake in codex.
This topic has been closed to new replies.