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

widget change "post slider" into "page slider" WordPress



I'm using the Templatic Enterprise Theme (

As you see there is a Content Slider. In the Widget menu I can type in an category ID so only some posts are shown.

But I would like to use the Slider for page contents.

I'm looking for someone who can change this for me so I can also type in page IDs which shall be shown in the Slider. And of course PAGES and not posts.

Please contact me.

Answers (2)


Suhas Sharma answers:

This is a simple WP_Query..

$query = new WP_Query( array( 'post__in' => array( 2, 5, 12, 14, 20 ) ) );

donald91 comments:

but where to change?
this is the main part of the slider-code:

global $post,$wpdb;
$catids = $category;
$sub_sql_cat = " and t.term_id in ($catids)";
$catQuery = $wpdb->get_results("select t.* from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"category\" $sub_sql_cat order by");
foreach ($catQuery as $category) {
$catLink = get_category_link($category->term_id);
$categoryid = $category->term_id;
$categoryname = $category->name;
$sql = "select p.* from $wpdb->posts p where p.post_type='post' and p.ID in (select tr.object_id from $wpdb->term_relationships tr join $wpdb->term_taxonomy t on t.term_taxonomy_id=tr.term_taxonomy_id where t.term_id=\"$categoryid\" ) order by p.post_date desc,p.ID desc limit 1";
$featureposts_obj = $wpdb->get_results($sql);


$postperslide = $post_per_slide;
foreach($featureposts_obj as $post)
if($counter=='0' || $counter%$postperslide==0){ echo "<li>";}?>
<div class="post_img">
<div class="post_img_in">
<div class="postimg">
if(get_the_post_thumbnail( $post->ID, array()))
<a href="<?php echo get_permalink($post->ID);?>"><?php echo get_the_post_thumbnail( $post->ID, array(238,136),array('class' => "",));?></a>
elseif( $post_images = bdw_get_images($post->ID,'large'))
global $thumb_url;
<h5><a href="<?php echo $catLink;?>"><?php echo $categoryname?></a></h5>
<a href="<?php echo get_permalink($post->ID);?>">
<img src="<?php echo get_bloginfo('template_url');?>/thumb.php?src=<?php echo $post_images[0];?>&amp;w=238&amp;h=136&amp;zc=1&amp;q=80<?php echo $thumb_url;?>" alt="<?php echo get_the_title($post->ID);?>" title="<?php echo get_the_title($post->ID);?>" /></a>
<a href="<?php echo get_permalink($post->ID);?>">
<span class="noimage"><?php _e('Image Not Available','templatic')?></span></a>
<?php }?>
<div class="postcontent">
<h3><span class="title"><a href="<?php echo get_permalink ($post->ID);?>" title="<?php echo get_the_title($post->ID);?>" ><?php echo get_the_title($post->ID);?></a></span></h3>
$text = $post->post_content;
$text = strip_tags($text);
$text = substr($text, 0, 100);
$text = substr($text, 0, strrpos($text, " "));
<p><?php echo $text.$ellipsis;?></p>
if($counter%$postperslide==0){ echo "</li>";}
} ?>


Duncan O'Neill answers:

Try this;

1) make a backup of the file.

2) Replace all the code from the line which begins $catQuery, down to, but NOT INCLUDING <div class="post_img"> with this;

$args = array('post_type'=>'page',"post__in"=>$catids,'numberposts'=>-1);

$catQuery = get_posts($args);


foreach ($catQuery as $post) {

if($counter=='0' || $counter%$postperslide==0){ echo "<li>";}

3) Comment out the last closing curly brace before the closing php tag, so that that line looks like //}?>