Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter mantralux

    (@mantralux)

    This is the test: http://www.arsenalreport.com/2011/02/arsenal-v-wolves-live-blog/

    It just won’t push any new posts through to the frontend.

    Thread Starter mantralux

    (@mantralux)

    Also, I can get it to work if I only have 2 levels of nested comments, but as soon as I go over that amount, it starts adding the .banner div to nested replies.

    Thread Starter mantralux

    (@mantralux)

    Adding the banner as a background to just the .bypostauthor class is not an option in my case I’m afraid. I need to insert a div into every comment made by the author, but somehow I need to get a round the fact that anything applied to .bypostauthor also gets applied to its nested replies.

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    After researching, I’ve solved the issue now, by replacing the following code:

    <?php query_posts('showposts=5'); ?>
    <?php $posts = get_posts('numberposts=5&offset=10'); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count3 = 0; if ($count3 == "5") { break; } else { ?>
    
    <p class="archive-date"><?php the_time('F jS, Y') ?></p>
    <p class="archive-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
    
    <?php $count3++; } ?>
    <?php endforeach; ?>

    With this:

    <?php
    global $post;
    $myposts = get_posts('numberposts=5&offset=0');
    foreach($myposts as $post) :
    setup_postdata($post);
    ?>
    <p class="archive-date"><?php the_time('F jS, Y') ?></p>
    <p class="archive-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
    <?php endforeach; ?>
    <?php $post = $tmp_post; ?>

    With a <?php wp_reset_query(); ?> at the end. Hopefully this isn’t a technique that will slow down the site more than the other technique, but at least it works. Thanks for your help alchymyth. =)

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    To clarify:

    If the header-archive.php only contains the following code:

    <div id="archive-columns">
    
    				<div id="column-1">
    					<?php $posts = get_posts('numberposts=5&offset=0'); foreach ($posts as $post) : setup_postdata($post); ?>
    					<?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>
    
    					<p class="archive-date"><?php the_time('F jS, Y') ?></p>
    					<p class="archive-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
    
    					<?php $count1++; } ?>
    					<?php endforeach; ?>
    				</div><!-- end column-1 -->
    
    				<?php wp_reset_query(); ?>
    
    </div><!-- end archive-columns -->

    The main page shows correctly, showing the blog as it should….but individual posts (single.php) are broken, all of them showing the latest post, not the post it should be showing.

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    Having a reset at the end of header-archive makes no difference, I still get the same result.

    I tried changing ‘start_wp()’ to ‘setup_postdata($post)’, here are my observations:

    1. If I change all 4 ‘start_wp()’ to ‘setup_postdata($post)’, I have the same issue as before – the main loop won’t initiate.

    2. If I use only the first column in header-archive (deleting the other three columns) and change ‘start_wp()’ to ‘setup_postdata($post)’ in that one column, I can now see the main loop – BUT individual posts will not show correctly, just like the issue I had in the OP.

    Lets re-phrase the question, to see how this can get solved:

    If you wanted to call in a loop in the header of your blog, showing the 20 latest posts, how would you code it?

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    Oh sorry, it’s just index.php, which calls in the header.php (that’s where the archive/nav part is), and then the loop is called into index.php, just as usual.

    The only files used are index.php, header.php and loop.php.

    Here they are in full:

    index.php:
    http://wordpress.pastebin.com/id4LDvsj

    header.php:
    http://wordpress.pastebin.com/wk7nbhFC

    header-archive.php (called in from header.php):
    http://wordpress.pastebin.com/dUmFTaJ4

    loop.php:
    http://wordpress.pastebin.com/mc50KLpZ

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    Unfortunately the site isn’t live yet, but here are the pastebins. First up is the archive/navigation part:

    http://wordpress.pastebin.com/mhq8vAk4

    It’s then followed by ‘normal’ HTML until the loop is included:

    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-index.php and that will be used instead.
    */
    get_template_part( 'loop', 'index' );
    ?>
    </div><!-- #content -->

    And then finally the loop itself, which is just a slightly modified Twenty Ten loop:

    http://wordpress.pastebin.com/mj9hjcgV

    Thanks again for helping me out. =)

    Forum: Fixing WordPress
    In reply to: Conflicting Loops?
    Thread Starter mantralux

    (@mantralux)

    Hello alchymyth, thanks for helping me out here.

    I removed just the <?php query_posts(‘showposts=5’); ?> lines from the header part, but now the problem is that the other loop (the main one) won’t show up at all, it just says “Apologies, but no results were found for the requested archive.” in the main blog area.

    Was I supposed to remove more than just the <?php query_posts(‘showposts=5’); ?> lines? Asking because you said “and the related lines”.

    I tried with and without the reset line, but it’s the same result.

    The main code area is just the default Twenty Ten loop, with a couple of lines removed (it works fine on its own).

    Thread Starter mantralux

    (@mantralux)

    Solved.

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