/** * Render Settings Page * * @access private * @since 1.0.0 * @return void */ function ctslider_render_settings_page($active_tab = '') { ob_start(); ?> <div class="wrap"> <div id="icon-themes" class="icon32"></div> <h2><?php _e('Captain Slider Settings', 'ctslider'); ?> </h2> <?php settings_errors(); ?> <?php if (isset($_GET['tab'])) { $active_tab = $_GET['tab']; } else { $active_tab = 'display_options'; } $donate = ctslider_options_each('donation'); if ($donate != 1) { echo '<p>'; _e('If you love Captain Slider, any donation would be appreciated! It helps to continue the development and support of the plugin.', 'ctslider'); printf(__('%sBut seriously, I just want to drink beer and coffee for free, so help a developer out.%sLove, Captain Theme (Bryce)%s', 'ctslider'), '<br /><em>', '</em><br /><strong>', '</strong>'); echo '<br/><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="TB5K5RXN8Q2XG"> <input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal: The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1"> </form>'; echo '</p>'; } ?> <h3><?php _e('Documentation', 'ctslider'); ?> </h3> <p><?php printf(__('I love writing documentation, so I wrote a lot of it for you: %sVisit Captain Slider Documentation%s.', 'ctslider'), '<strong><a href="http://cpthe.me/sliderdocs">', '</a></strong>'); ?> </p> <form method="post" action="options.php"> <?php if ($active_tab == 'display_options') { settings_fields('ctslider_all_options'); do_settings_sections('ctslider_all_options'); } submit_button(); echo ob_get_clean(); }
<?php $width = ctslider_options_each('width'); $height = ctslider_options_each('height'); // Check custom width/height for slider has been set before adding the image size. If not, do nothing. if ($width && $height != 0) { add_image_size('ctslider_slide', $width, $height, true); } // Omit that damn closing PHP tag
function ctslider_slider_template($id) { // Query Arguments $args = array('post_type' => 'slides', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); $array2 = array(array('taxonomy' => 'slider', 'field' => 'id', 'terms' => $id)); if ($id) { $args['tax_query'] = $array2; } // The Query $the_query = new WP_Query($args); // Check if the Query returns any posts if ($the_query->have_posts()) { ob_start(); ?> <div class="flexslider"> <ul class="slides"> <?php //$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); //data-thumb="<?php echo $thumb; ? >" while ($the_query->have_posts()) { $the_query->the_post(); ?> <li <?php post_class(); ?> > <?php // Check if there's a Slide URL given and if so let's a link to it if (get_post_meta(get_the_id(), 'ctslider_slidelink', true) != '') { ?> <a href="<?php echo esc_url(get_post_meta(get_the_id(), 'ctslider_slidelink', true)); ?> "> <?php } if (get_post_meta(get_the_id(), 'ctslider_videoembedcode', true) != '') { // Slide Video ?> <?php echo get_post_meta(get_the_id(), 'ctslider_videoembedcode', true); ?> <?php } else { // The Slide's Image $width = ctslider_options_each('width'); $height = ctslider_options_each('height'); // Check custom width/height for slider has been set. If so, display a thumbnail with that size. If not, display normal thumbnail. if ($width && $height !== 0) { echo the_post_thumbnail('ctslider_slide'); } else { echo the_post_thumbnail(); } } // Close off the Slide's Link if there is one if (get_post_meta(get_the_id(), 'ctslider_slidelink', true) != '') { ?> </a> <?php } ?> <?php // Slide Caption if (get_post_meta(get_the_id(), 'ctslider_captiontext', true) != '') { ?> <p class="flex-caption"><?php echo get_post_meta(get_the_id(), 'ctslider_captiontext', true); ?> </p> <?php } ?> </li> <?php } ?> </ul><!-- .slides --> </div><!-- .flexslider --> <?php echo ob_get_clean(); } wp_reset_postdata(); }
/** * Load Slider * * Add the jQuery for the slider to wp_head * * @access private * @uses add_filter() * @uses ob_start() * @uses ob_get_clean() * @since 1.0.0 * @return void */ function ctslider_slider_load() { $effect = ctslider_options_each('effect'); $automatic = ctslider_options_each('automatic'); $controlnav = ctslider_options_each('bullets'); $arrownav = ctslider_options_each('arrows'); $slidespeed = ctslider_options_each('slidelength'); $anispeed = ctslider_options_each('animationlength'); ob_start(); ?> <script type="text/javascript"> /* Slider Parameters */ jQuery(window).load(function() { jQuery(".flexslider") .fitVids() .flexslider({ animation: '<?php if ($effect == 'fade') { echo 'fade'; } else { echo 'slide'; } ?> ', // Specify sets like: 'fade' or 'slide' direction: '<?php if ($effect == 'slideh') { echo 'horizontal'; } else { echo 'vertical'; } ?> ', slideshow: <?php if (1 == $automatic) { echo 'false'; } else { echo 'true'; } ?> , controlNav: <?php if (1 == $controlnav) { echo 'false'; } else { echo 'true'; } ?> , directionNav: <?php if (1 == $arrownav) { echo 'false'; } else { echo 'true'; } ?> , slideshowSpeed: <?php echo $slidespeed; ?> , animationSpeed: <?php echo $anispeed; ?> , useCSS: false, animationLoop: true, smoothHeight: true, //controlNav: "thumbnails" }); }); </script> <?php echo ob_get_clean(); }