I have posted the PHP code here too. I really hope you can help me with this one. Thank you very much.
/*-----------------------------------------------------------------------------------*/
/* Slides
/*-----------------------------------------------------------------------------------*/
if( ! function_exists( 'pixy_slides' ) ) {
function pixy_slides( $id, $options ) {
// Fixed Height
$height = '';
if( $options['height'] )
$height = ' style="height:'.$options['height'].'px"';
$output = '<ul class="pi-slides pi-slides-'.$options['setup']['style'].'">';
// Slide content
$i = 0;
$class = null;
foreach( $options['setup']['names'] as $key => $name ) {
$output .= '<li '.$height.'>';
switch( $options[$key]['type'] ) {
case 'page' :
$page_id = pixy_post_id_by_name( $options[$key]['page'], 'page' );
$page = get_page( $page_id );
$output .= apply_filters( 'the_content', $page->post_content );
break;
case 'raw' :
$output .= apply_filters( 'the_content', stripslashes( $options[$key]['raw'] ) );
break;
}
$output .= '</li>';
$i++;
}
$output .= '</ul><!-- .pi-slides (end) -->';
return $output;
}
}
if( ! function_exists( 'pixy_shortcode_slides' ) ) {
function pixy_shortcode_slides( $atts, $content = null ) {
$default = array(
'style' => 'framed', // framed, open, left, right
'height' => '', // Optional fixed height for inside of tabs
'class' => '' // Optional class for element-tabs container
);
extract( shortcode_atts( $default, $atts ) );
if( isset( $atts['style'] ) ) unset( $atts['style'], $atts['class'], $atts['height'] );
$id = uniqid( 'slides_'.rand() );
$num = count( $atts ) - 1;
$i = 1;
$options = array(
'setup' => array(
'num' => $num,
'style' => $style,
'class' => $class,
'names' => array()
),
'height' => $height
);
if( is_array( $atts ) && ! empty( $atts ) ) {
foreach( $atts as $key => $slide ) {
$options['setup']['names']['slide_'.$i] = $slide;
$slide_content = explode( '[/'.$key.']', $content );
$slide_content = explode( '['.$key.']', $slide_content[0] );
$options['slide_'.$i] = array(
'type' => 'raw',
'raw' => $slide_content[1],
);
$i++;
}
$output = '<div class="element element-slides '.$class.' '.pixy_get_classes( 'element_slides', true ).'">'.pixy_slides( $id, $options ).'</div><!-- .element (end) -->';
} else {
$output = '<p class="pi-warning alert">'.__( 'No slides found', 'aeryn' ).'</p>';
}
return $output;
}
}
add_shortcode( 'slides', 'pixy_shortcode_slides' );