Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter selfcomposed

    (@selfcomposed)

    I have party figured out the solution but its still not quite there.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php static $count = 1; if ($count == "3") { break; } else { ?>
    
     <?php if (in_category('3') && !is_single() ) continue; ?>
     <?php if (in_category('4') && !is_single() ) continue; ?>
     <?php if (in_category('9') && !is_single() ) continue; ?>
    
    <?php $count++; } ?>
    <?php endwhile; ?>
    <?php endif; ?>

    This functions the way I want in that it only allows posts from the one category, but it falls short of a desireable solution because I have to take the posts out of any other categories for them to show here.

    Is there a way to change the code above so that instead of excluding posts that are in any other category, it shows only the posts in the one particular category regardless what other categories they may belong in?

    Thread Starter selfcomposed

    (@selfcomposed)

    Michael as far as I can tell, The Loop article (which I had already consulted before posting here) does not tell me how to do what I asked in this thread. If I’m mistaken, please direct me to the example in the article where it does.

    I need a loop that will only disply posts from one particular category.

    If possible, I’d like it to be able to be a multi-part type thing so I can do things like display the entire contents of the first post in that category, and only the excerpts in the following posts.

    Maybe it would help if I showed the code I’m already using to accomplish most of what I want, which is the entire contents of a post from a particular category in one column, possibly followed by excerpts from the next few posts in that category. In the other column, there are excerpts from all the posts excluding the one category presented in the first column.

    So far, I have the second column behaving exactly as I need it to do – there is a loop of all my posts except the ones in a particular category.

    What I can’t figure out is making the part of the loop in the left column only display posts from the particular category.

    // First part of loop in left column
    // This is the only part that doesn't work the way I want
    // This is the part I want to display posts from cat 39 only
    <?php query_posts('showposts=1'); ?>
    <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count1 = 0; if ($count1 == "1" ) { break; } else { ?>
    
    // Second part of loop in middle column
    <?php query_posts('showposts=2'); ?>
    <?php $posts = get_posts('numberposts=2&offset=0'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count2 = 0; if ($count2 == "2") { break; } else { ?>
    	<?php if (in_category('39') && !is_single() ) continue; ?>
    
    // Third part of loop
    <?php query_posts('showposts=2'); ?>
    <?php $posts = get_posts('numberposts=2&offset=2'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count3 = 0; if ($count3 == "2") { break; } else { ?>
    	<?php if (in_category('39') && !is_single() ) continue; ?>
    
    // Fourth part of loop
    <?php query_posts('showposts=2'); ?>
    <?php $posts = get_posts('numberposts=2&offset=4'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count4 = 0; if ($count4 == "2") { break; } else { ?>
    		<?php if (in_category('39') && !is_single() ) continue; ?>
    
    // Fifth part of loop
    <?php query_posts('showposts=2'); ?>
    <?php $posts = get_posts('numberposts=2&offset=6'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count5 = 0; if ($count5 == "2") { break; } else { ?>
    		<?php if (in_category('39') && !is_single() ) continue; ?>
    
    // Sixth part of loop - for titles/links only
    <?php query_posts('showposts=8'); ?>
    <?php $posts = get_posts('numberposts=8&offset=8'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count6 = 0; if ($count6 == "8") { break; } else { ?>
    		<?php if (in_category('39') && !is_single() ) continue; ?>

    For anyone wondering, the reason for breaking it up into sections is I want other content between each part.

    Again, all but the first part of the loop functions the way I want it to.

    I tried using the same exclude stuff – one for each of the other categories but it still showed all the other posts. I don’t understand why that didn’t work either.

    Thread Starter selfcomposed

    (@selfcomposed)

    Thanks but that has little to do with what I’m asking for. I’m needing a loop, the member in the thread you linked to was looking for a list of titles in the sidebar.

    Thread Starter selfcomposed

    (@selfcomposed)

    Bleh. Attention to detail. One of the quickest ways I can see the mistake I made on my own is to ask the world to look for it.

    I neglected to change the numberposts= in the third line of each loop.

    Thread Starter selfcomposed

    (@selfcomposed)

    That’s what I would have thought too, but it doesn’t work. It still inherits the #sidebar stuff.

    I put

    #twitt ul li a {
    border-bottom: 3px solid #ff0000;
    color: #00ff00;
    display: inline;
    background-image: none;
    font-size: 26px;
    }
    
    #twitt ul li a:hover {
    color: #0000ff;
    background-color: #660000;
    }

    in my style sheet and it ignores it. By the way, I don’t really want all the things that code does, I’m just trying things to see what it ignores and what it doesn’t.

    I don’t see the e.

    Is there supposed to be gray space between the nav menu and the green? On IE6 here at work, the categories list is above the darker green backgroun where the rest of the sidebar stuff is. The content with green background begins about two inches (on this screen) below the nav menu.

    Cross-browser issues are a real bother.

    You seem to be having some of the same problems I am.

    The section on the right begins adjacent to the bottom of the section on the left when viewed in IE6.

    I see background on your rounded corners.

    Your name header thingy overlaps the tree. Is it supposed to be gray?

    Along the left side things don’t seem to look as they should.

    I spent a weekend on my site, got it looking right in IE7 and Firefox, then came to work and saw IE6 has everything all messed up.

    Thread Starter selfcomposed

    (@selfcomposed)

    I don’t know if this is a “good” fix, but I ended up using
    list-style-position: outside;
    and cleared all the padding and margins, and it seems to look ok in IE and Firefox now.

    Fantastic!

    Thread Starter selfcomposed

    (@selfcomposed)

    Thanks Kafkaesqui, that got me headed in the right direction. Much appreciated.

    Now to get the form box to fit within its column. I may be back. ??

    Thread Starter selfcomposed

    (@selfcomposed)

    Thanks samboll. I have the WP installation unzipped on my hard drive – do I now just browse to the intall file like I did on the server? Will it install without SQL?

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