HELP a novice needs help with Coda Slider!
-
I’m in the process of putting together my site and am new to wordpress. I’ve activated and installed the slider but do not know the next steps to get it to work. Please help, here is the code below:
/Template tag functionfunction c3m_wpcodaslider($id, $cat, $show, $args) {
$template_tag_args = array(
‘post_type’ => ‘post’,
‘cat’ => $cat,
‘posts_per_page’ => $show
);query_posts( $template_tag_args );
echo ‘<div class=”coda-slider-wrapper”> <!– yes –>
<div class=”coda-slider preload” id=”‘. $id .'”>’;if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(‘panel’); ?>>
<div class=”panel-wrapper”>
<h2 class=”title”><?php the_title(); ?></h2>
<?php echo apply_filters(‘the_content’, $post->post_content); ?>
</div> <!– .panel-wrapper –>
</div> <!– .panel –>
<?php endwhile; else:
endif;
wp_reset_query(); ?></div><!– .coda-slider .preload –>
</div><!– coda-slider-wrapper –>
<?php echo'<script type=”text/javascript”>
jQuery(document).ready(function($){
$().ready(function() {
$(\’#’. $id .’\’).codaSlider({‘ . $args .’});
});
});
</script>’;
return $id;
return $cat;
return $show;
return $args;}
//End Template Tag Function//Lets load the scripts
add_action (‘init’, ‘c3m_coda_scripts’);function c3m_coda_scripts() {
wp_enqueue_script(‘coda_slider’, WP_PLUGIN_URL . ‘/wp-coda-slider/js/coda.slider.js’, array( ‘jquery’ ));
wp_enqueue_style(‘coda_slider_css’, WP_PLUGIN_URL . ‘/wp-coda-slider/css/coda-slider-2.0.1.css’);
wp_localize_script( ‘coda_slider’, ‘Plugin_Url’, array( ‘plugin_url’ => WP_PLUGIN_URL ) );
}//Begin Shortcode function
$my_wpcodaslider = new wpcodaslider();
class wpcodaslider{var $shortcode_name = ‘wpcodaslider’;
var $pattern = ‘<!– wpcodaslider –>’;
var $posts_content = ”;function wpcodaslider() {
add_shortcode( $this->shortcode_name, array( &$this, ‘shortcode’ ) );}
// insert the shortcode in any page ie: [wpcodaslider id=slidername cat=4 show=3] will show first three post in category with id $
function shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
‘cat’ => null,
‘id’ => null,
‘show’ => null,
‘args’ => null
), $atts ) );//Make sure there is a query and name
if (! $cat || ! $id)
return ‘Could not load slider. Mallformed shortcode.’;
$o = ‘
<div class=”coda-slider-wrapper”>
<div class=”coda-slider preload” id=”‘. $id .'”>’;$shortcode_args = array(
‘post_type’ => ‘post’,
‘cat’ => $cat,
‘posts_per_page’ => $show
);$posts = get_posts( $shortcode_args );
foreach($posts as $post){
$o.=
‘<div class=”panel” id=”post-‘ . $post->ID . ‘”>
<div class=”panel-wrapper”>
<h2 class=”title”>’ . $post->post_title . ‘</h2>
‘ . apply_filters(‘the_content’, $post->post_content) . ‘
</div> <!– .panel-wrapper –>
</div><!– .panel #post-$id –>’;
}$o.=’
</div><!– .coda-slider .preload –>
</div><!– coda-slider-wrapper –>
<script type=”text/javascript”>
jQuery(document).ready(function($){
$().ready(function() {
$(\’#’. $id .’\’).codaSlider({‘ . $args .’});
});
});
</script>’;return $o;
}
}?>
- The topic ‘HELP a novice needs help with Coda Slider!’ is closed to new replies.