Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • In case others are looking for what I was looking for, this is what I came up with:

    <?php $args = array(
    	'posts_per_page' => 1,
    	'post__in'  => get_option('sticky_posts'),
    	'caller_get_posts' => 1,
    	'category__not_in' => array(5,151)
    );
    query_posts($args);?>
    	<?php while (have_posts()) : the_post(); $do_not_duplicate = $post->ID; ?>

    Pretty much copied from the Codex: Function Reference/Query Posts

    Actually in playing around I’ve discovered that a sticky post gets called first. So with the above code, if I have the latest post in category 4 and another post that is sticky, both posts appear at the top of the page with lead formatting.

    So is there a way to get that loop to return only one post, i.e. the most recent that post that is sticky or is not in category 5?

    Again, most grateful if anyone can help me.

    Hey, this has been really useful. I have a slightly different project in mind. I’m using the Mimbo theme which highlights the most recent post in a lead div. I’m trying to modify it so that the lead post excludes certain categories, which I have pulled off, but how would I have it show a post if it is sticky?

    This is what I have:

    <div id="lead" class="clearfloat">
    
    <!---Loop One to Get Lead Story Excluding Category 5 (About KZBlog)-->
    	<?php
             $blog_query = 'showposts=1&cat=-5&paged='.$paged;
    	$posts = query_posts($blog_query);
    	while (have_posts()) : the_post(); ?>
    
    <!--Loop One Publish Details of Story-->
    
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <br />
    <!--Lead Post Image-->
    <?php $cti = catch_that_image(); if(isset($cti)){ ?>
    <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $cti; ?>&h=230&w=230&zc=1" alt="Link to <?php the_title(); ?>" 
    
    class="thumbnail"/>
     <?php } else {?><img src="https://www.kzblog.net/wp-content/uploads/2010/03/defaultfeaturedimg.png"><?php } ?>
    </a>
    
    <!--Lead Post Text-->
    	<div id="lead-text">
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
        <?php the_title(); ?></a> <span class="commentcount"> (<?php comments_popup_link('0', '1', '%'); ?>)</span></h2>
        <br /><p class="postmetadata"><?php _e('Categorized as','Mimbo'); ?> <?php the_category(',') ?>
    <br /><?php the_tags('Tagged as ',', ');?></p>
    
    	<?php the_excerpt(); ?><p align="right"><a href="<?php the_permalink() ?>" rel="bookmark" title="More">Read More</a></p>
    
    </div>
    <!--End Loop One--?
    <?php endwhile; ?>
    <!--End Lead or Sticky Post-->

    Not a php expert but can I modify this:

    <?php
             $blog_query = 'showposts=1&cat=-5&paged='.$paged;
    	$posts = query_posts($blog_query);
    	while (have_posts()) : the_post(); ?>

    to say OR if sticky is true?

    Thanks in advance.

    Thread Starter kzblog

    (@kzblog)

    Didn’t solve this issue but Google Reader has an excellent feature called Clips that lets you post your feed to a website. Also Google Reader Recommended Reading is a cool plug in if you want to show shared items only.

    Thread Starter kzblog

    (@kzblog)

    For these particular tags, I put in my css

    #content .postmetadata a:link
    {
    color:#b464e5;
    }

    That worked fine.

    Thread Starter kzblog

    (@kzblog)

    Thanks for cleaning that up for me. I really don’t know php, just trying to reason it out.

    I still can’t get links to change color.
    When I try:
    <span style="color:#b464e5"><?php the_category(',') ?></span>
    it has no effect. I.e. the color of the link is the same as when I have
    <?php the_category(',') ?>

    Thread Starter kzblog

    (@kzblog)

    For some odd reason, placing

    #nav-cat li {
      border-right:none;
    }

    at the very end of the css file worked. I had been placing it where the rest of the style commands for that section were–where I was setting link color and all that–which failed.

    Thanks cais!

Viewing 7 replies - 1 through 7 (of 7 total)