hello guys, expert and wordpress coders:
i am using a slider news in my own wp theme.it's called [[LINK href="http://landofcoder.com/our-porfolios/jquery-plugins.html"]]lofslidernews[[/LINK]].
in html vesrsion everything works for me fine, but when i tried to integrate a query loop to pull out the last 3 featured news, my nightmare began.
in fact, the slider works great, but the only problem is taht with the permalinks of the news sorted. for ex: i have the 3 news that this query would n sorted by the most recent to oldest (from 3 to 1).
news1--->permalink id 1
news2--->permalink id 2
news3--->permalink id 3
the slider works fine and each slide show the right thumb image, title, excerpt except the right permalink id. i mean every a href post shows and redirect to the peramlinh id 1 which is for the news number 1 when clicked on it.
also i can not clik on the excerpt of the news 2 and news 3 even if i put a href tag on code. strange.
i have tried to change the query, reset it but no luck.
wht's wrong please help, here is my code :
<!--deb3slider-->
<!-- THE CONTENT -->
<div id="lofslidecontent45" class="lof-slidecontent" style="width:470px; height:213px;">
<div class="preload"><div></div></div>
<!-- MAIN CONTENT -->
<div class="lof-main-outer" style="width:470px; height:213px;">
<div onclick="return false" href="" class="lof-previous">Previous</div>
<?php
wp_reset_query();
query_posts('showposts=3&category_name=affiche');
if ( have_posts() ) : ?>
<ul class="lof-main-wapper">
<?php while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('feature'); ?></a>
<div class="lof-main-item-desc">
<h3><a target="_parent" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">/ <?php the_title(); ?> /</a> — <?php the_date(); ?></h3>
<?php
$excerpt = get_the_content();
$new_excerpt = explode(' ', $excerpt, 20);
array_pop($new_excerpt);
$new_excerpt = implode(' ', $new_excerpt);
echo $new_excerpt; ?> ...
{ <a class="readmore" href="<?php the_permalink(); ?>" rel="bookmark" title="Lien Permanent vers <?php the_title(); ?>">Lire la suite</a> }
</div>
</li>
<?php endwhile; ?>
<?php else: ?>
<?php endif; ?>
</ul>
<div onclick="return false" href="" class="lof-next">Next</div>
</div>
</div>
<!-- // slider -->
help me please
Duncan O'Neill answers:
Hi Alhmoum,
Two quick ideas;
1) Shouldn't you be resetting the query BEFORE you instantiate the new object?
wp_reset_query();
$my_query = new WP_Query('showposts=3&category_name=affiche');
2) Also, try get_the_ID() in place of $post->ID;
$do_not_duplicate = get_the_ID();
$thumb = get_post_meta(get_the_ID(), 'feature', true);
Hope this helps.
alhmoum comments:
no change as well.i totally removed them but no luck..thnkx anyway
Duncan O'Neill comments:
<?php echo get_permalink(get_the_ID()); ?>
alhmoum comments:
tried your solution same problem..arrrrrrrrrgh
i don't understand why the same loop (query) is working proprely using it outside the html code for the slider. strange
alhmoum comments:
here is the [[LINK href="http://alhmoum.ardesignstudio.fr/"]]demo[[/LINK]]
Duncan O'Neill comments:
Your query is working properly in the demo. The links are there for the other two items, ids 27 and 10. I think that what's happening is that the last permalink id ( of 1 ) is over-laying the other two.
Duncan O'Neill comments:
You could confirm what I've said above by ordering the query by descending ID. Put this on the end of your query;
&order=ASC
What should happen there is that the post with an id of 27 should show last, and the link will then lead to the post with the permalink id of 27. That'll confirm that the last item is over-laying the other two.
Duncan O'Neill comments:
It may just have to do with the incorrect nesting of your <div>s.
Ignoring the validation errors pertaining to the flash embed, there are end tags for <div>s which aren't open. That may be your problem. Here's the validation result;
http://bit.ly/amOAqU
alhmoum comments:
hi thanks for ur help
i will try to solve the unclosing tags, but i have an idea told by someone in an other forum.
the problem may come from conflict or error on the slider css.
cause when i deactivat this css file, the news are showing with the right permalink, and the slider works also. it just loose its style. so i will see if that figure it out.
Duncan O'Neill comments:
OK, that sounds feasible, I hope that works for you.
You probably already know this, but here are two tools for sorting out the css;
1) the W3c validator;
http://bit.ly/aKF9kZ
2) Firebug ( with Firefox )
http://getfirebug.com/
best,
Duncan
alhmoum comments:
i fix it out was very simple, but when you think that the problem comes from wp or your loop, you are getting far from the real problem.
the problem comes from an error in the slider css included in the downloaded package.
go to css/style6.css and remove all "px" from the z-index css . that was the error.
any way thanks for your help partially, but i gonan pay for your effort, and many thanks for the others
Pippin Williamson answers:
Well, one problem is that you're not closing your "li" tag.
But that wouldn't cause the problem. Can you post a demo URL?
alhmoum comments:
here is the [[LINK href="http://alhmoum.ardesignstudio.fr/"]]demo[[/LINK]]
Denzel Chia answers:
Hi,
Seems like the following is redundant and maybe causing the permalink problem,
Try removing the below codes from your query, and see if it fixes your problem.
$do_not_duplicate = $post->ID;
$thumb = get_post_meta($post->ID, 'feature', true);
Thanks.
alhmoum comments:
here is the [[LINK href="http://alhmoum.ardesignstudio.fr/"]]demo[[/LINK]]
Ehthisham tk answers:
place <?php wp_reset_query(); ?> before the query starts
alhmoum comments:
it dosen't change anything..sorry but thanx anyway
alhmoum comments:
here is the [[LINK href="http://alhmoum.ardesignstudio.fr/"]]demo[[/LINK]]
Nilesh shiragave answers:
Instead of
<?php the_permalink() ?>
for the href use
<?php echo get_permalink($post->ID); ?
alhmoum comments:
it dosen't solve my problem thanx anyway
here is the [[LINK href="http://alhmoum.ardesignstudio.fr/"]]demo[[/LINK]]