WordPress.org

Ready to get started?Download WordPress

Forums

Remaindered Link/Aside issue (8 posts)

  1. HRTWRK
    Member
    Posted 8 years ago #

    I'm trying to implement the remaindered link/aside feature for my personal site. The site is built off the Kubrck template, and isn't drastically different underneath.

    I tried using the widely available aside code:

    <?php //if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>

    <?php if ($posts)
    {
    function stupid_hack($str)
    {
    return preg_replace('|<br/>s*&nbsp;|', '', $str);
    }
    ob_start('stupid_hack');
    foreach($posts as $post)
    {start_wp(); ?>
    <?php if ( in_category(21) && !is_single() ) : ?>

    with "21" being the category ID for links. But everytime I insert this code into my index.php page, I get an error on the subsequent <?php endwhile; ?>. If I remove that code, the next php declaration shows an error, etc. on down the line.

    What am I doing wrong? I'm a total php newbie, and any help would be appreciated.

  2. Beel
    Member
    Posted 8 years ago #

    Not seeing the whole code (you could put it up in pastebin), this is just a guess. You commented out the original code and replaced it with code that requires a <?php } ?> instead of endwhile. I close out the hack a bit after my previous/next links.

  3. Ming
    Member
    Posted 8 years ago #

    I think that's Matt's aside code but I haven't tried it myself. I did notice that you've commented out the first php statement of your old loop but you didn't comment out the second. The // turns the line into a comment but only until it hits a ?>

    Try adding a // to the second php statement
    <?php //if (have_posts()) : ?><?php //while (have_posts()) : the_post(); ?>

    I like your site's design. Clean, funky and not overly dark.

  4. Beel
    Member
    Posted 8 years ago #

    In my index page the code looks like this:
    <?php // if (have_posts()) : while (have_posts()) : the_post(); ?>
    Not sure why yours is split out like it is.

  5. HRTWRK
    Member
    Posted 8 years ago #

    @ Beel - I fixed the split code. I'm not sure why that was there either. I'm not sure what you mean by the first comment though. Could you explain a bit more (talk to me liek i'm an idiot, I promise it's ok).

    @ Ming - Thanks.

  6. Beel
    Member
    Posted 8 years ago #

    The original code, which you commented out, requires and "endwhile" at the end of the loop. Now that it is commented out, you need to comment the end out also. The code you added requires the <?php } ?> to end it - at least that is my take. I am just one classification above idiot myself (I believe that makes me an imbecile ;-)

    Check out #7 and #8:
    http://codex.wordpress.org/Adding_Asides

  7. HRTWRK
    Member
    Posted 8 years ago #

    Good call on the missing <?php } ?> tag. It's always something simple.

    Thank you kindly.

  8. Ming
    Member
    Posted 8 years ago #

    Nice Beel. Answering the problem without seeing the full code must moves you up a level!

Topic Closed

This topic has been closed to new replies.

About this Topic