array(
'name' => __('Anim8 Slides'),
'singular_name' => __('Slides')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'Slides'),
'supports' => array( 'title'),
)
);
}
add_action('init', 'anim8_create_post_type');
//Script and Style Injection
function anim8_enqueue_style() {
wp_enqueue_style('myscript', plugins_url('/anim8/anim8.css'));
}
function anim8_enqueue_script() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script('myscript', plugins_url('/anim8/anim8.js'));
}
add_action( 'init', 'anim8_enqueue_style' );
add_action( 'init', 'anim8_enqueue_script' );
// ShortCode Handler
function Anim8Display() {
$options = get_option('anim8_theme_options');
$width = $options['width'];
$height = $options['height'];
echo '
';
echo '
';
$featuredPosts = new WP_Query();
$featuredPosts->query(array('post_type' => 'anim8Slides', 'posts_per_page' => -1));
while ($featuredPosts->have_posts()) : $featuredPosts->the_post();
//Background Image handler
global $wpdb;
$images = get_post_meta(get_the_ID(), 'background-image', false);
$images = implode(',', $images);
// Re-arrange images with 'menu_order'
$images = $wpdb->get_col("
SELECT ID FROM {$wpdb->posts}
WHERE post_type = 'attachment'
AND ID in ({$images})
ORDER BY menu_order ASC
");
foreach ($images as $att) {
// Get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes
$src = wp_get_attachment_image_src($att, 'full');
$src = $src[0];
//Display Subroutine
echo "- ";
echo '
:';
echo ' ';
}
endwhile;
echo '
';
echo '
';
}
add_shortcode('Anim8', 'Anim8Display');
?>