WordPress.org

Ready to get started?Download WordPress

Forums

Featured Content Gallery
Selecting Category does not work (1 post)

  1. m0gb0y74
    Member
    Posted 2 years ago #

    When you select a category, the posts that come after the plugin are only from that category. This is caused by the fact that when you set the variable to take a copy of the original query you are not in fact copying it, just making two variables point to the query object, so a change in one variable is reflected in the other.

    Below is the code to fix this issue:

    else {
    	    	$fcgArgs = 'category_name=' . get_option('gallery-category') . '&showposts=' . get_option('gallery-items');
    	    	$temp_query = new WP_Query($fcgArgs);
    
    			while ($temp_query->have_posts()) : $temp_query->the_post(); ?>
    	       <div class="imageElement">
    	         <h2><?php the_title() ?></h2>
    	         <?php
    						if(get_option('gallery-use-featured-content')) {?>
    					     <p><?php $key="featuredtext"; echo get_post_meta($post->ID, $key, true); ?></p>
    					  <?php
    					  } else {
    					  ?>
    					     <p><?php the_content_rss('', 0, '', $wordquantity); ?></p>
    					  <?php
    						}
    						?>
    					  <a>" title="Read More" class="open"></a>
    					  <img src="<?php $key="articleimg"; echo get_post_meta($post->ID, $key, true); ?>" alt="<?php $key="alttext"; echo get_post_meta($post->ID, $key, true); ?>" class="full" />
    					  <img src="<?php $key=$imgthumb; echo get_post_meta($post->ID, $key, true); ?>" alt="<?php $key="alttext"; echo get_post_meta($post->ID, $key, true); ?>" class="thumbnail" />
    	      </div>
    	      <?php endwhile;
    		      // Reset Post Data
    		      wp_reset_postdata();
    	      ?>
        	</div>
    	  <?php
    	  }?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by m0gb0y74
  • This topic is not a support question
  • WordPress version: 3.2.1