Forums

[resolved] Problem getting posts from specific category to js "crossfader" (3 posts)

  1. Begin
    Member
    Posted 2 years ago #

    I have a javascript crossfader that cross fade between posts
    from my website, but i can't get it to take posts from only
    category-3 instead of posts from all the categorys...

    This is the code:

    <div id="articles" class="crossfader">
    	<?php $מאמרים_posts = new WP_Query('category=3&numberposts=10&order=ASC&orderby=rand');
    	while ($מאמרים_posts->have_posts()) : $מאמרים_posts->the_post();
    	$div_ids[] = get_the_ID();?>
    
    		<div id="cf<?php the_ID(); ?>" class="cf_element">
    		<a href="<?php the_permalink() ?>" rel="bookmark" title="לחצו כדי לקרוא על <?php the_title_attribute(); ?>">
    		<h1><?php the_title(); ?></h1>
            <img src="images/articles/
    		<?php echo get_post_meta($post->ID, 'article_thumb', true); ?>_thumb.png"/>
            </a>
    	    <p>
    		<?php echo get_post_meta($post->ID, "article_review", true);?>
    		</p>
    		</div>
    	<?php endwhile; ?>
    
    	<script type="text/javascript">
    	var cf = new Crossfader( new Array(
    	<?php
    	foreach ($div_ids as $id) {
    	$stringlist[] = "'cf".$id."'";
    	}
    	echo implode (',',$stringlist);
    	?>
    	), 3000, 2000 );
    	</script>
    </div><!-- end div articles class=crossfader -->

    ???

  2. Mark / t31os
    Moderator
    Posted 2 years ago #

    Change..

    new WP_Query('category=3&numberpos

    to...

    new WP_Query('cat=3&numberpos

  3. Begin
    Member
    Posted 2 years ago #

    Wow thank you!!! so simple :-)

Topic Closed

This topic has been closed to new replies.

About this Topic