WordPress.org

Forums

Help with Matt's asides (31 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    I have just recently switch to WP and am having a bit of trouble. I am trying to set up Matt's asides on my blog, but whenever I edit my template according to the instructions on Matt's site, I can't load my site, but instead get an error that says:
    Parse error: parse error, unexpected T_ENDFOREACH ...
    Being a complete WP novice, I have no idea what this means or how to go about fixing it. Any suggestions would be much appreciated.

  2. Anonymous
    Unregistered
    Posted 10 years ago #

    I have tried adding this but still not working.
    My post loop (I think that is what it is called?) is:
    <?php
    if ($posts) {
    function stupid_hack($str) {
    return preg_replace('| \s*<ul class="asides">|', '', $str);
    }
    ob_start('stupid_hack');
    foreach($posts as $post) { start_wp();
    ?>
    <?php if (in_category(9) && !$single) { ?>
    <ul class="asides">
    <li id="p<?php the_ID(); ?>"><?php echo wptexturize($post->post_content); echo ' '; comments_popup_link('(0)', '(1)', '(%)')?> <?php edit_post_link('(e)'); ?>


  3. <?php } else { ?>
    <?php the_date('','<h2>','</h2>'); ?>
    <div class="post">
    <h3 class="storytitle" id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h3>
    <div class="meta"><?php _e("Filed under:"); ?> <?php the_category() ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <?php } // closes printing entries with excluded cats ?>
    <div class="feedback">
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    <?php include(ABSPATH . 'wp-comments.php'); ?>
    </div>
    <?php endforeach; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>
    </div>

  • gregorsmith
    Member
    Posted 10 years ago #

    I was able to get them working
    here is the excerpt from my index.php
    <div id="textarea">
    <div class="content">
    <?php
    if ($posts) {
    function stupid_hack($str) {
    return preg_replace('|

    \s*<ul class="linklog">|', '', $str);
    }
    ob_start('stupid_hack');
    foreach($posts as $post) { start_wp();
    ?>
    <h2><?php the_date() ?></h2>
    <?php if (in_category(14) && !$single) { ?>
    <ul class="linklog">

  • <?php echo wptexturize($post->post_content); echo ' '; comments_popup_link('(0)', '(1)', '(%)' ) ?>
  • <?php } else { ?>
    <h3 class="posttitle">" title="Permalink to '<?php the_title(); ?>'"><?php the_title(); ?></h3>
    <p class="posted">" title="Permalink to '<?php the_title(); ?>'"><?php the_time() ?> | <?php the_category( ' | ') ?><span class="screenonly"> | " title="<?php comments_number("0 comments","1 comment","% comments") ?>">Comments:<?php comments_number("0","1","%") ?></span>
    <div class="postbody">
    <?php the_content(); ?>
    <?php trackback_rdf(); ?>
    <?php include(ABSPATH . 'wp-comments.php'); ?>
    </div>
    <?php } // end if in category ?>
    <?php } } else {
    echo 'Sorry no posts found.';
    }
    ?>
    </div>

  • gregorsmith
    Member
    Posted 10 years ago #

    ok, that didnt work out too well...
    try here, http://www.scamcity.co.uk/journal/index.txt

  • Anonymous
    Unregistered
    Posted 10 years ago #

    Thank you both so much! They are working. Now on to the next task :)

  • Stevarino
    Member
    Posted 10 years ago #

    Heh, glad you got them working...
    FWI the problem was with these lines:
    endforeach; else:
    and
    endif;
    The top should be "} } else {" and the bottom simply "}".

  • lawtai
    Member
    Posted 10 years ago #

    I end up getting this error:
    Parse error: parse error, unexpected '}' in /home/virtual/site29/fst/var/www/html/test.php on line 90
    with that occuring after the endif;

  • lawtai
    Member
    Posted 10 years ago #

    anyone?

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    I wrote this up:
    http://www.tamba2.org.uk/wordpress/asides/
    Help at all ?

  • ryoken
    Member
    Posted 10 years ago #

    does that work with wp 1.3 betas as well?

  • Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    If you're using 1.3-alpha already here is the exact code I'm using right now, optimized for 1.3 functions:
    http://codex.wordpress.org/User:Matt/photomatt.net/index.php

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    I'll sort that into a page like above tomorrow if that's okay Matt ?

  • ryoken
    Member
    Posted 10 years ago #

    wow, thanks matt. i'll try that as soon as i get my stupid .htaccess issue fixed up...

  • Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Podz, whatever you need is yours.
    Lawtai, try taking out the } on line 90 and see what happens.

  • Beel
    Member
    Posted 10 years ago #

    Well, optimized for 1.3 looks good, but what I've got works and it was easier adding all the pieces parts bit by bit than trying to "optimize" them now. I keep "breaking" it somewhere down the line. Don't know how you guys do it - makes my head swim... or hurt!
    (Looks like lawtai is in the same boat ; )

  • lawtai
    Member
    Posted 10 years ago #

    lol yea, don't know why it doesn't want to work!

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    Sorted for 1.3pre-alpha2
    http://www.tamba2.org.uk/wordpress/asides2/
    Took ages to work out that did ! :)

  • lawtai
    Member
    Posted 10 years ago #

    well this work for 1.2 as well?

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    It does, but the code you need to comment out is different
    http://www.tamba2.org.uk/wordpress/asides/ - for 1.2
    http://www.tamba2.org.uk/wordpress/asides2/ - for 1.3

  • lawtai
    Member
    Posted 10 years ago #

    hmm ok, cause i followed the guide for 1.2 and ended up wtih that error the first try around.

  • Anonymous
    Unregistered
    Posted 10 years ago #

    Try removing the trailing v from the last line. That did it for me.

  • lawtai
    Member
    Posted 10 years ago #

    thanks lfaren! that seemed to do the trick!

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    lawtai - is there an error on the page I did ?

  • lawtai
    Member
    Posted 10 years ago #

    yea, i followed to the instructions for 1.2 and with the v in there i get an error

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    Ah !
    I hadn't seen that - I'll delete it right now - thanks for pointing it out :)

  • lawtai
    Member
    Posted 10 years ago #

    thanks for putting together the guide podz!

  • Vohiyaar
    Member
    Posted 10 years ago #

    Can this be done in WP 1.02?

  • iand
    Member
    Posted 10 years ago #

    I didn't have a problem getting this to work thanks to Podz excellent guide (btw on the 3rd line from the bottom(1.2 guide), texturize is with a s, so doesn't work if you copy and paste). However, I am also using MTdew's recent posts plugin and want to stop the titles in the asides category from showing. Any suggestions? there doesn't seem to be any way of excluding categories.

  • Mark (podz)
    Support Maven
    Posted 10 years ago #

    Thanks for spotting the typo :)
    Unfortunately, I haven't the answer to your query ....

  • Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Vohiyaar, 1.0 doesn't have the in_category() function that this kinda depends on.

  • 12

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.