Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Content wont update WordPress

  • REFUNDED

Im using the wp snap plugin to have an alphabetical order navigation but the content never updates. I always see the same two posts. It's the same even if i use wp_pagenavi plugin.

Is it because it's a 'page' that is queryng a category? Url changes but content always stayes the same.

here is the url of the page

http://aussisimple.com/clients/inpix/boutiques



<div id="content">
<div class="Box">
<?php the_content(); ?>
</div>
<div class="box">
<div class="separator"></div>
<?php
$query = 'cat=4&orderby=title&order=ASC&posts_per_page=2';
$queryObject = new WP_Query($query);
// The Loop...
if ($queryObject->have_posts()) {
while ($queryObject->have_posts()) {
$queryObject->the_post(); ?>



<div class="shopName"><h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3></div>
<div class="shopDesc"><?php echo cutMe(get_the_excerpt()); ?></div>
<ul class="shop">
<li class="uppercase"><?php echo get('location_shop', 1); ?></li>
<li><?php echo get('tel_shop', 1); ?></li>
<li><?php echo get('siteweb_shop', 1); ?></li>
</ul>

<div class="separator"></div>


<?php }
}
?>

<div class="navigation">
<?php if (function_exists('wp_snap')) { echo wp_snap(); } ?>
<!--?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?-->
</div>
</div>

</div>

Answers (4)

2010-05-24

Navjot Singh answers:

Are you sure that this is the only reason? Tried removing wp-snap/wp-pagenavi codes and replace with generic navigation code?


Roberto Mas comments:

Genric navigation doesent work eighter

2010-05-24

Stew Heckenberg answers:

The line that controls what content gets returned is:
$query = 'cat=4&orderby=title&order=ASC&posts_per_page=2';

According to the WordPress Codex [[LINK href="http://codex.wordpress.org/Template_Tags/query_posts"]]page about query posts[[/LINK]], this means:

"get me items from category with ID 4, order (sort) them by their title, make this ordering ascending (i.e. A to Z), and display 2 items"

If new posts don't have the category with ID 4, then they won't be included. If you want to display pages instead of posts, add '&post_type=page' to the $query variable above. If you want both posts and pages make it '&post_type=any' -- by default it will return just posts.

So my guess is that the posts that aren't showing up like you expect don't have category with ID 4.


Roberto Mas comments:

i have about 10 items (posts not pages) for now in cat 4. Im only displaying 2. WHen i click the navigation link i want to display the other results depending of the letter.

http://aussisimple.com/clients/inpix/boutiques


Stew Heckenberg comments:

Roberto, your initial post asked about why it was displaying the same 2 posts -- you didn't ask how to display all posts for a particular letter...

...that said, if you remove the "posts_per_page=2" part from the query it should display all posts for that query, or perhaps change that number to something bigger like 20 or 200.

2010-05-24

Noah Coffey answers:

It could be that your navigation area (which is using WP_Query) is occuring inside the main loop on that page. Try moving it outside the main loop and see if it works. If so, you'll need to restructure your page to make sure you are not looping inside the main loop.

If you are indeed creating a 2nd loop inside the main page loop, calls like the_title(); can confuse Wordpress and it won't know which loop to take them from.

2010-05-25

Rashad Aliyev answers:


<?php query_posts("cat=-1&showposts=15&paged=$paged");?>

<?php while (have_posts()) : the_post(); ?>

your styled code here.. for examle .. <?php the_title(); ?> as you wish...

<?php endwhile; ?>
<div style="clear:both" ></div>





I give code for pagging.. there are as you see cat=-1 (not showing category as you wish) and showposts=15 (15 post showing) and pagging.. <strong>paged=$paged</strong> for <strong>WP-PageNavi</strong> plugin.

As you see you've only need <strong>paged=$paged</strong>.

That's all!!..