• Resolved gpsy1

    (@gpsy1)


    I want slider to show specific category howi do that….here is slider code

    $gazpo_settings = get_option( 'gazpo_options');
    	$slider_cat_id = $gazpo_settings['gazpo_slider_category'];
    	//if no category is selected for slider, show latest posts
    	if ( $slider_cat_id == 0 ) {
    		$post_query = 'posts_per_page=4&ignore_sticky_posts=1';
    	} else {
    		$post_query = 'cat='.$slider_cat_id.'&posts_per_page=4&ignore_sticky_posts=1';
    	}
    ?>
    
    <div id="gazpo-slider" >
    		<ul class="ui-tabs-nav ui-tabs-selected">
    			<?php query_posts( $post_query ); ?>
    			<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    			<li class="ui-tabs-nav-item" id="nav-fragment-<?php echo $post->ID; ?>">
    			<a href="#fragment-<?php echo $post->ID; ?>">
    				<?php the_post_thumbnail( 'thumbnail', array('class' => 'slider_thumb') ); ?>
    				<span class="title">
    						<?php $short_title = mb_substr(the_title('','',FALSE),0,40);
    						echo $short_title; if (strlen($short_title) >39){ echo '...'; } ?>
    				</span>
    				<br />
    				<span class="date"><?php the_time('F j'); ?></span>
    			</a>
    			</li>
    			<?php endwhile; endif;?>
    			<?php wp_reset_query();?>
    	    </ul>
    
    		<?php query_posts( $post_query ); ?>
    		<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    		<div id="fragment-<?php echo $post->ID; ?>" class="ui-tabs-panel ui-tabs-hide" style="">
    			<?php the_post_thumbnail( 'large', array('class' => 'slider_image') ); ?>
    			 <div class="info" >
    				<h2>
    					<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    					<?php $short_title = mb_substr(the_title('','',FALSE),0,35);
    					echo $short_title; if (strlen($short_title) >34){ echo '...'; } ?>
    					</a>
    				</h2>
    				<p>
    				<?php
    					$content = get_the_content();
    					$content = strip_tags($content);
    					echo mb_substr($content, 0, 150). '...';
    				?>
    				</p>
    			 </div>
    	    </div>
    
    			<?php endwhile; endif;?>
    			<?php wp_reset_query();?>
    </div>

    how i make this point to specific category….please!

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter gpsy1

    (@gpsy1)

    Oh my god….sorry im working on this all day so tired now….thanx for the help… will corect that and let you know

    Thread Starter gpsy1

    (@gpsy1)

    Corected , its almost there but still don’t look good…its adding more posts than what it should.

    Looks like you pasted something wrong on archives.php because it is cut off.

    But the amount of the query is set on

    &posts_per_page=4

    Did you change that?

    I would think

    $post_query = 'cat='.$slider_cat_id.'&posts_per_page=4&ignore_sticky_posts=1';

    would only show 4 posts.

    Thread Starter gpsy1

    (@gpsy1)

    Still it doesn’t change posts per category!

    This is just beyond my knowledge, it looks like this will take a long time to fix …i want to say that i appreciate all your work and time …

    Thread Starter gpsy1

    (@gpsy1)

    <?php $category = get_the_category(); ?>
    <?php $category_id = $category->cat_ID; ?>
    <?php $post_query = 'cat='.$slider_cat_id.'&posts_per_page=4&ignore_sticky_posts=1'; ?>
    <?php query_posts( $post_query ); ?>

    i belive i did

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘How to change category for slider?’ is closed to new replies.