WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] JS slider function not selecting featured category (2 posts)

  1. Amy55
    Member
    Posted 2 years ago #

    Hello, Experts,
    I'm using a modification of Akylas theme (based, I think on Tauri), which has a built in js slider (not a plugin, unfortunately). The slider itself works great, but it doesn't select the content based on category. The code is this:

    <!-- BEGIN featured -->
    <div id="featured">
    
    	<div class="container">
    
    		<?php
    		$tmp_query = $wp_query;
    	query_posts('showposts=4&cat=' . get_cat_ID(dp_settings('featured')));
    		if (have_posts()) :
    		while (have_posts()) : the_post();
    		?>
    
    		<div class="item">
    			<a class="thumb" href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'medium', 'alt="' . $post->post_title . '"'); ?></a>
    			<p class="date"><?php the_time('F j, Y') ?></p>
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			<?php the_excerpt(); ?>
    		</div>
    
    		<?php
    		endwhile;
    		endif;
    		$wp_query = $tmp_query;
    		?>
    
    	</div>
    
    	<a href="#" class="previous">Previous</a>
    	<a href="#" class="next">Next</a>
    
    </div>
    <!-- END featured -->

    It seems that if I select the "featured" category for each of the posts I want to feature, they should show up in the slider. However, I only get the most recent X posts (4 in this case).

    Short of routinely changing the dates of the posts I want to feature (as, essentially, static content for the sliders), I don't know how to get the slider to either a) select the category properly, or b) simply insert some code (don't know what) that would hard code the pages I wanted to feature into the slider.

    Does anyone have any advice?

    The site, http://www.olympusresumes.com is live but the theme I'm changing to isn't live yet.

    Many thanks,
    Amy

  2. Amy55
    Member
    Posted 2 years ago #

    I figured it out. The settings.php called "featured1" not "featured" as the name of the field. So I changed that in the code above

    from

    query_posts('showposts=4&cat=' . get_cat_ID(dp_settings('featured')));
    to
    query_posts('showposts=4&cat=' . get_cat_ID(dp_settings('featured1')));

    Now I can sort by category. Very frustrating, but fixed now.

Topic Closed

This topic has been closed to new replies.

About this Topic