Forums

[resolved] What am I doing wrong? ---> php code for sidebar (5 posts)

  1. ButterflyHerder
    Member
    Posted 4 months ago #

    Hi there -

    I'm working on some custom code for a client's sidebar. It shows up exactly the way I want it on the FIRST bullet, but everything after that doesn't show up correctly (i.e. the little yellow icon is missing and text is not indented). Can anybody tell me what I'm doing wrong?

    You can find a visual at: http://www.theretailersadvantage.net.previewdns.com/

    Here's the code... thanks in advance for your help!

    <ul id="sidebarwidgeted">
    <li id="upcoming-events">
    <h2>Upcoming Events</h2>

    • <?php $recent = new WP_Query("cat=4&showposts=4"); while($recent->have_posts()) : $recent->the_post();?><b>

      " rel="bookmark" style="color:#a32400;"><?php the_title(); ?></b> <?php the_content_limit(70, "[More...]"); ?>

      <div style="border-bottom:1px dotted #2255AA; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>

    <?php endwhile; ?>

  2. ButterflyHerder
    Member
    Posted 4 months ago #

    CORRECTION... the code I pasted above didn't show up correctly. I'm trying it again...

    <ul id="sidebarwidgeted">
    	<li id="upcoming-events">
        <h2>Upcoming Events</h2>
    
    	<ul>
            <li><?php $recent = new WP_Query("cat=4&showposts=4"); while($recent->have_posts()) : $recent->the_post();?><b>
    
            <a href="<?php the_permalink() ?>" rel="bookmark" style="color:#a32400;"><?php the_title(); ?></a></b> <?php the_content_limit(70, "[More...]"); ?>
    
            <div style="border-bottom:1px dotted #2255AA; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>
    
            </li>
            </ul>
    <?php endwhile; ?>
  3. t31os_
    Member
    Posted 4 months ago #

    Update to ..

    <ul id="sidebarwidgeted">
    	<li id="upcoming-events">
    		<h2>Upcoming Events</h2>
    		<?php
    		$recent = new WP_Query("cat=4&showposts=4");
    		if($recent->have_posts()) :
    		?>
    		<ul>
    			<?php while($recent->have_posts()) : $recent->the_post();?>
    			<li>
    				<strong><a href="<?php the_permalink() ?>" rel="bookmark" style="color:#a32400;"><?php the_title(); ?></a></strong>
    				<?php the_content_limit(70, "[More...]"); ?>
    				<div style="border-bottom:1px dotted #2255AA; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>
    			</li>
    			<?php endwhile; ?>
    		</ul>
    		<?php endif; ?>
    	</li>
    </ul>

    I'm not sure if you just failed to post the surrounding code, so i've added closing tags where appropriate.

  4. ButterflyHerder
    Member
    Posted 4 months ago #

    FABULOUS! That's it... I just forgot to do the closing tags! How silly!

    Thanks SOOO much for your help! My eyes get tired after looking at code for so long. It's nice to have friends in this forum who can give it a fresh look.

    Have a great weekend!
    Cynthia

  5. t31os_
    Member
    Posted 4 months ago #

    lol...

    Glad i could help... ;) you to....("Have a great weekend") :)

Reply

You must log in to post.

About this Topic