• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

Custom Sidebar - How to Add new Widget / Plugin (recent comments)

Hello, my site is http://tiny.cc/a4guz 

on the sidebar, I would like to get rid of Popular Articles and replace it with a new plugin i just installed called "Recent Comments with Avatars". Since I am unfamiliar with PHP, I am not sure what code to put in so I can do this...

Any help?

Thanks :)
<div class="mainright">







		  	<div id="sidebar">



			



<!-- Search Section -->			



			<div id="searchsection">



				<?php include (TEMPLATEPATH . '/searchform.php'); ?>



                <div class="clear"><!-- --></div>



			  </div>



			  



			<?php 	/* Widgetized sidebar, if you have the plugin installed. */



					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>



<!-- End of Search Section -->		











<!-- Poll  -->	



<?php if (function_exists('vote_poll') && !in_pollarchive()): ?>				



	<div class="sidebarWrap" id="poll">



			<h2>Polls</h2>



            <div class="sbContent">



            <?php get_poll();?>



            </div>



	</div>



    <?php endif; ?> 



<!-- End of Poll  -->











<!-- Your Ad Here -->







	<div class="sidebarWrap" id="sponsor2">



			<h2>Support our Sponsors</h2>



			<div class="sbContent">

<!-- Beginning of Project Wonderful ad code: -->

<!-- Ad box ID: 51333 -->

<script type="text/javascript">

<!--

var pw_d=document;

pw_d.projectwonderful_adbox_id = "51333";

pw_d.projectwonderful_adbox_type = "4";

pw_d.projectwonderful_foreground_color = "";

pw_d.projectwonderful_background_color = "";

//-->

</script>

<script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script>

<!-- End of Project Wonderful ad code. -->

</p>

			



			</div>



	</div>



<!-- End of yOUR aD HERE   -->


<!-- Featured Stunna -->					



	<div class="sidebarWrap" id="featured">



			<h2>Stunna Babe of the Moment</h2>



			<div class="sbContent">



<script type="text/javascript" >NumberOfImagesToRotate = 12;FirstPart = '<img src="fansign/fan';LastPart = '.jpg" height="190" width="250">';function printImage() {var r = Math.ceil(Math.random() * NumberOfImagesToRotate);document.write(FirstPart + r + LastPart);}

printImage();</script>

<br><a href="http://www.stunnazine.com/fan-sign-submission.html">Be Seen! Submit your fan sign here</a>

		</div>

	</div>


<!-- End of Featured Stunna -->	



<!-- SZ Team  -->
<div class="sidebarWrap" id="team">
<h2>Advertisement</h2>

<div class="marTop">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-7308943566145520";
/* bigger sidebar ad */
google_ad_slot = "4824911313";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

		</div>

	</div>
<!-- End of SZ Team  -->


<!-- Popular Post -->


	<div class="sidebarWrap" id="popPost">


			<h2>Popular Articles | Hot Topics</h2>


			<div class="sbContent">


			<ul>


			<? //popularPosts(5);
				 $popular = new WP_Query('orderby=comment_count&posts_per_page=10');
					 while ($popular->have_posts()) : $popular->the_post();
					?>
					<li>
					 <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
					 <!--<span><?php //comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link', ''); ?></span>-->
					</li>
					<?php endwhile;

			?>
			</ul>


			</div>

	</div>

<!-- End of Popular Post   -->


<!-- Support -->

<div class="sidebarWrap" id="support">

<h2>Donations</h2>

<div class="sbContent">

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

<input type="hidden" name="cmd" value="_s-xclick">

<input type="hidden" name="hosted_button_id" value="7051702"><input type="image" src="<?php bloginfo('template_directory'); ?>/images/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"></form>


<p>You can help keep this <a href="http://www.stunnazine.com/about.html">free webzine </a> online.</p>        

</div>
</div>



<!-- End of Support   -->


<!-- Cool Sites  -->

<div class="sidebarWrap" id="coolSite">
<h2>Our Friends</h2>
<div class="sbContent">
<ul class="leftCol divider">

<li><a href="http://www.hairflip.net" rel="nofollow" class="menulink">Page Graphics</a></li>

<li><a href="http://wemakeyoulaugh.blogspot.com/" rel="nofollow" class="menulink2">Make You Laugh</a></li>
</ul>
<ul class="leftCol">

<li><a href="http://www.steelcitymovement.webs.com" rel="nofollow" class="menulink">Konvict and Tip-Z</a> </li>

<li><a href="http://www.myspacehoz.com" rel="nofollow" class="menulink">MySpace Hoz</a></li>
</ul>

<div class="clear"><!-- --></div>
</div>
</div>
<!-- End of Cool Sites  -->
<?php endif; ?>

</div> <!-- End side bar -->

</div>
<div class="clear"><!-- --></div>

Open in new window

0
VenusBreeze
Asked:
VenusBreeze
2 Solutions
 
jeremyjared74Commented:
Just add this to your functions.php file:
register_sidebar(array('name'=>'sidebar4',
 'before_widget' => '<ul><li>',
 'after_widget' => "</li></ul>",
 'before_title' => '<h2 class="widgettitle">',
 'after_title' => "</h2>"
  ));

Open in new window


Then add this to your sidebar.php file:
  <div class="bottom-sidebar">
    <?php if ( function_exists ( dynamic_sidebar(4) ) ) : ?>
    <?php dynamic_sidebar (4); ?>
    <?php endif; ?>
  </div>

Open in new window


You'll now have a place to drag the widget in your Appearance>Widgets panel.

NOTE:
I'm not sure if you've noticed, or maybe don't care but your sidebar has at least two javascript functions in it. This is a problem waiting to happen. If you start having issues with plugins not working or any other number of issues, that's where I'd start troubleshooting. In WordPress all Javascript should be registered either in the head, or after the wp_footer hook. Best practice is to use the functions.php file to register the scripts. If the sidebar is that bad, the rest of the theme is probably a hack also.
Good Luck.
0
 
Ryan BayneWordPress DeveloperCommented:
He is right on the Javascript note for sure.

I add a lot of Javascript too my own plugins admin pages but I only load the Javascript when those pages are being viewed. It limits any conflict and it makes for fast development but it is still not 100% safe so I will eventually move it all to be adding in header or footer.

Don't worry about it too much if your not planning on adding many plugins you'll probably be fine but Wordpress can protect you from conflict by doing what jeremyjared74 recommends.
0
 
Jason C. LevineNo oneCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now