Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] query_post in sidebar widget area in php code widget thingy (http://forum.bytesforall.com/showthread.php?t=13934)

bonnbonn Apr 27, 2011 12:11 AM

[SOLVED] query_post in sidebar widget area in php code widget thingy
 
Hi again!

I am really in need of help, I am trying to use the code below to pull the most recent posting content from a category into a left sidebar php widget area

Code:

<?php query_posts('category_name=updates&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php the_content(); ?>
<?php endwhile;?>

When I do this it is posting beautifully in the left sidebar but is also overriding my page center content as well and displaying the same post in the center area. Would it be possible to have some guidance with this? I would like my center area content to stay as I have it but also do the query_post content display as I need it to in the left sidebar.

I have already tried to use the plug-in query posts but it is not letting me style it as I need to for this to work, so I am having to resort to hard coding the left widget.

Thank you for your time!
BonnBonn

lmilesw Apr 27, 2011 11:06 AM

What do you mean by "hard coding the left widget"?

bonnbonn Apr 27, 2011 02:38 PM

thank you for responding! I appreciate it very much..

First, Hardcoding meaning I am not using a prefab plugin to do what I would like to happen, I am putting actual code in the left side bar widget php widget item. Meaning when I drag it from my widget choices I am putting actual php code and truthfully right now I had to copy and paste my text from the post that I want to use in a text widget for the time being.


Second, when you refer to the loop are you talking about the small section I am using or in the center pages loop? Forgive the noob question I want to make sure that we are on the same "code speak page"

So to be clear I just need to add
Code:

<?php wp_reset_query(); ?>
below the following?

Code:

<?php query_posts('category_name=updates&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php endwhile;?>

Lemme give it a shot, crossing fingers, Will be back with the results!! :)

BonnBonn

bonnbonn Apr 27, 2011 03:14 PM

YAY! IT WORKS!!!... I owe you a bearhug! TY TY TY!

http://50.22.80.91/~drblack/wp/

BonnBonn :)


All times are GMT -6. The time now is 04:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.