Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial Commit

  • Loading branch information...
commit 62c5c28a7e46df5d52c79201d36fee53c8c1680f 1 parent 0185a29
@bryceadams authored
View
109 README.md
@@ -1,4 +1,111 @@
Captain-Slider
==============
-Probably the best free slider plugin around
+* **Contributors:** captaintheme, bryceadams123
+* **Donate link:** http://captaintheme.com/
+* **Tags:** captain theme, captain slider, slider, jquery slider, responsive slider, slideshow, video slider, mobile slider, flexslider
+* **Requires at least:** 3.3
+* **Tested up to:** 3.5
+* **Stable tag:** trunk
+* **License:** GPLv2 or later
+
+> Probably the Best Free jQuery Slider/Slideshow Plugin for Wordpress. Responsive, Settings & Multiple Sliders!
+
+## Description
+
+This is the Slider Plugin I always wished I had. Simply install the plugin, add some slides & use your slider! It's that easy.
+
+**Features:**
+
+* Plenty of Settings like animation, speed, etc.
+* Multiple Sliders
+* Slider Sorter: Order your slides using drag & drop AJAX.
+* Responsive
+* Video Slides
+* Captions
+* Slide Links
+* Shortcode
+* Free
+
+**There are 2 ways to use your sliders:**
+
+* PHP - `<?php echo ctslider_slider_template( $id ); ?>`
+* Shortcode - `[slider id=""]`
+
+**Credits:**
+
+* Made by [Captain Theme](http://captaintheme.com/)
+* Uses [Flexslider](http://woothemes.com/flexslider/)
+
+**Documentation:**
+[Captain Slider Documentation](http://cpthe.me/sliderdocs)
+
+## Installation
+
+How to install this plugin?
+
+1. Search for "Captain Slider" in the Add New Plugin section of your site or download it and upload it manually.
+1. Install and activate the plugin.
+1. Create Slides under the new **Captain Slider** Menu.
+1. Use your Slider with either PHP or the Shortcode.
+1. Magic!
+
+## Frequently Asked Questions
+
+> **I’m getting the following error message when using PHP to display my slider (with all slides): Warning: Missing argument 1 for nextslider_slider_template(), called in etc. etc.**
+
+
Some hosting set-ups may have this issue. Just give it an empty parameter like so:
+
+```
+// All slides, with empty parameter set to stop warning from appearing
+<?php echo nextslider_slider_template(''); ?>
+```
+---
+
+> **My slider isn’t displaying the specific slider I want?**
+
+
Make sure that you’re stating the ID correctly like the examples above. Remember that you can find the slider ID under Slides > Sliders.
+
+---
+
+> **My slider’s just not displaying!**
+
+
If you’ve done everything else right and it’s still not displaying, you’re probably having a jQuery conflict with another plugin/theme. Try reverting back to the default Twenty Eleven or Twenty Twelve theme and disabling each plugin one by one.
+
+---
+
+> **Can I display multiple sliders on one page?**
+
+
+Why yes you can!
+
+---
+
+> **Which slider does Captain Slider use?**
+
+
Captain Slider proudly uses the lovely [Flex Slider](http://woothemes.com/flexslider/) by [WooThemes](http://woothemes.com/)
+
+---
+
+> **How can I say thanks Captain Theme?**
+
+How sweet of you. Anything from a small donation (made through the Captain Slider settings page) to a link to Captain Theme (http://captaintheme.com/) on your site helps!
+
+
+
+## Other Notes
+
+**Want to help?** Translate the Plugin! It's really easy using something like [the Codestyling Localization plugin](http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en), or an app like [Poedit](http://www.poedit.net/). You know what's even better? You get to help thousands of people! And I link to you! How good is that? Just [contact me](mailto:bryce@captaintheme.com) to talk about it. I'll even give you a present ;)
+
+
+
+##Changelog
+
+**Version 1.0.0 (07/11/2012):**
+
+* Initial Release.
+
+
+---
+
+###Found a bug? [Open an issue!](https://github.com/bryceadams/Captain-Slider/issues)
View
BIN  assets/images/bg_direction_nav.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
16 assets/images/move.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px"
+ height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<g id="Layer_1">
+</g>
+<g id="move">
+ <g>
+ <polygon style="fill:#4E4E50;" points="18,20 18,26 22,26 16,32 10,26 14,26 14,20 "/>
+ <polygon style="fill:#4E4E50;" points="14,12 14,6 10,6 16,0 22,6 18,6 18,12 "/>
+ <polygon style="fill:#4E4E50;" points="12,18 6,18 6,22 0,16 6,10 6,14 12,14 "/>
+ <polygon style="fill:#4E4E50;" points="20,14 26,14 26,10 32,16 26,22 26,18 20,18 "/>
+ </g>
+</g>
+</svg>
View
16 assets/images/move_alt1.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px"
+ height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<g id="Layer_1">
+</g>
+<g id="move_x5F_alt1">
+ <g>
+ <polygon style="fill:#4E4E50;" points="16,22 18,20 18,26 22,26 16,32 10,26 14,26 14,20 "/>
+ <polygon style="fill:#4E4E50;" points="16,10.062 14,12 14,6 10,6 16,0 22,6 18,6 18,12 "/>
+ <polygon style="fill:#4E4E50;" points="10,16 12,18 6,18 6,22 0,16 6,10 6,14 12,14 "/>
+ <polygon style="fill:#4E4E50;" points="21.938,16 20,14 26,14 26,10 32,16 26,22 26,18 20,18 "/>
+ </g>
+</g>
+</svg>
View
171 captain-slider.php
@@ -0,0 +1,171 @@
+<?php
+/*
+Plugin Name: Captain Slider
+Plugin URI: http://captaintheme.com/plugins/captain-slider/
+Description: Allows you to easily create multiple jQuery sliders.
+Author: Captain Theme
+Author URI: http://captaintheme.com
+Version: 1.0
+Text Domain: ctslider
+License: GNU GPL v2
+*/
+
+
+/*
+|--------------------------------------------------------------------------
+| CONSTANTS
+|--------------------------------------------------------------------------
+*/
+
+// Plugin Folder Path
+if( !defined( 'CTSLIDER_PLUGIN_DIR' ) ) {
+ define( 'CTSLIDER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
+}
+
+// Plugin Folder URL
+if ( ! defined( 'CTSLIDER_PLUGIN_URL' ) ) {
+ define( 'CTSLIDER_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
+}
+
+/*
+|--------------------------------------------------------------------------
+| INCLUDES
+|--------------------------------------------------------------------------
+*/
+
+/*---------------------*/
+/* ADMIN
+/*---------------------*/
+
+// Slider Sorter

You should put all of these in an if ( is_admin() ) block so they don't load on the front-end.

@bryceadams Owner

Ah good point, I forgot that's why I originally segregated everything haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/sorter.php' );
+
+// Register Some Settings
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/settings.php' );
+
+// Slider's Post Type
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/post-types.php' );
+
+// Slider's Taxonomies
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/taxonomy.php' );
+
+// Slider's Metabox
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/meta-box.php' );
+
+// Slider's User Interface
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/admin/ui.php' );
+
+
+/*---------------------*/
+/* FRONT END
+/*---------------------*/
+
+// Slider's Main Template
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/front-end/template.php' );
+
+// Slider's Shortcode
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/front-end/shortcode.php' );
+
+// Slider's Size
+include_once( CTSLIDER_PLUGIN_DIR . 'includes/front-end/custom-size.php' );
+
+
+
+/*
+|--------------------------------------------------------------------------
+| I18N - LOCALIZATION
+|--------------------------------------------------------------------------
+*/
+
+load_plugin_textdomain( 'ctslider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
+
+
+/*
+|--------------------------------------------------------------------------
+| SCRIPTS/STYLES
+|--------------------------------------------------------------------------
+*/
+
+function ctslider_load_scripts() {
+

You should register all scripts then enqueue then. Not necessary at all but just a best practise.

Also always put version numbers when loading styles and scripts. The reason being is that WordPress caches them and if you update them in a newer version but the version number is the same. WordPress won't update the cache unless you do a hard refresh.

We had the same problem in EDD with the new dashboard widget.

@bryceadams Owner

With the version should I just set the parameter to true or give it a specific version number? (probably same as the plugin version)

@bryceadams Owner

Just read Pippin's article on the subject, doing the define constant for version number thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ wp_enqueue_script( 'jquery' );
+
+ wp_enqueue_style( 'flex-style', CTSLIDER_PLUGIN_URL . 'css/flexslider.css' );
+
+ wp_enqueue_script( 'flex-script', CTSLIDER_PLUGIN_URL . 'js/jquery.flexslider-min.js', array( 'jquery' ), false, true );
+
+ wp_enqueue_script( 'fitvid', CTSLIDER_PLUGIN_URL . 'js/jquery.fitvids.js', array( 'jquery' ), false, true );
+
+}
+add_action('wp_enqueue_scripts', 'ctslider_load_scripts');
+
+
+// Admin Scripts/Styles
+function ctslider_load_admin_scripts($hook) {
+ global $post;
+ if( 'edit.php' == $hook && 'slides' == $post->post_type ) {

Best to === rather than ==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ wp_enqueue_style( 'admin-styles', CTSLIDER_PLUGIN_URL . 'css/admin-styles.css' );
+ }
+}
+add_action( 'admin_enqueue_scripts', 'ctslider_load_admin_scripts' );
+
+
+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' ); ?>
+
+ <script type="text/javascript">

Remember to send this through an output buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ /* 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 ( $automatic == 1 ) { echo 'false'; } else { echo 'true'; } ?>,
+ controlNav: <?php if ( $controlnav == 1 ) { echo 'false'; } else { echo 'true'; } ?>,
+ directionNav: <?php if ( $arrownav == 1 ) { echo 'false'; } else { echo 'true'; } ?>,
+ slideshowSpeed: <?php echo $slidespeed; ?>,
+ animationSpeed: <?php echo $anispeed; ?>,
+ useCSS: false,
+ animationLoop: true,
+ smoothHeight: true,
+ //controlNav: "thumbnails"
+ });
+
+ });
+ </script>
+
+ <?php
+}
+add_action( 'wp_head', 'ctslider_slider_load' );
+
+
+/*
+|--------------------------------------------------------------------------
+| OTHER-FUNCTIONS
+|--------------------------------------------------------------------------
+*/
+
+/*****
+ * Add 'Settings' Link to Plugins Page
+**/
+
+function ctslider_settings_link($links, $file) {
+ static $this_plugin;
+
+ if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
+
+ if ($file == $this_plugin){
+ $settings_link = '<a href="edit.php?post_type=slides&page=ctslider_all_options">'.__("Settings", "eddslider").'</a>';

Instead of using edit.php?post_type=slides&page=ctslider_all_options you should use admin_url( 'edit.php?post_type=slides&page=ctslider_all_options' );.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ array_unshift($links, $settings_link);
+ }
+
+ return $links;
+}
+add_filter('plugin_action_links', 'ctslider_settings_link', 10, 2 );
View
8 css/admin-styles.css
@@ -0,0 +1,8 @@
+/* Hide Date Select Menu From Showing */
+#posts-filter .tablenav select[name=m] {
+ display: none;
+}
+
+#ctslider_post_thumb {
+ width: 15%;
+}
View
132 css/flexslider.css
@@ -0,0 +1,132 @@
+/*
+ * jQuery FlexSlider v2.0
+ * http://www.woothemes.com/flexslider/
+ *
+ * Copyright 2012 WooThemes
+ * Free to use under the GPLv2 license.
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * Contributing author: Tyler Smith (@mbmufffin)
+ */
+
+
+/* Browser Resets */
+.flex-container a:active,
+.flexslider a:active,
+.flex-container a:focus,
+.flexslider a:focus {outline: none;}
+.slides,
+.flex-control-nav,
+.flex-direction-nav {margin: 0; padding: 0; list-style: none;}
+
+/* FlexSlider Necessary Styles
+*********************************/
+.flexslider {margin: 0; padding: 0;}
+.flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
+.flexslider .slides img {width: 100%; display: block;}
+.flex-pauseplay span {text-transform: capitalize;}
+
+/* Clearfix for the .slides element */
+.slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
+html[xmlns] .slides {display: block;}
+* html .slides {height: 1%;}
+
+/* No JavaScript Fallback */
+/* If you are not using another script, such as Modernizr, make sure you
+ * include js that eliminates this class on page load */
+.no-js .slides > li:first-child {display: block;}
+
+
+/* FlexSlider Default Theme
+*********************************/
+.flexslider {margin: 0 0 60px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.2); -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1;}
+.flex-viewport {max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; transition: all 1s ease;}
+.loading .flex-viewport {max-height: 300px;}
+.flexslider .slides {zoom: 1;}
+
+.carousel li {margin-right: 5px}
+
+
+/* Direction Nav */
+.flex-direction-nav {*height: 0;}
+.flex-direction-nav a {width: 30px; height: 30px; margin: -20px 0 0; display: block; background: url(../assets/images/bg_direction_nav.png) no-repeat 0 0; position: absolute; top: 50%; cursor: pointer; text-indent: -9999px; opacity: 0; -webkit-transition: all .3s ease;}
+.flex-direction-nav .flex-next {background-position: 100% 0; right: -36px; }
+.flex-direction-nav .flex-prev {left: -36px;}
+.flexslider:hover .flex-next {opacity: 0.8; right: 5px;}
+.flexslider:hover .flex-prev {opacity: 0.8; left: 5px;}
+.flexslider:hover .flex-next:hover, .flexslider:hover .flex-prev:hover {opacity: 1;}
+.flex-direction-nav .flex-disabled {opacity: .3!important; filter:alpha(opacity=30); cursor: default;}
+
+/* Control Nav */
+.flex-control-nav {width: 100%; position: absolute; bottom: -40px; text-align: center;}
+.flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
+.flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; box-shadow: inset 0 0 3px rgba(0,0,0,0.3);}
+.flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
+.flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }
+
+.flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
+.flex-control-thumbs li {width: 25%; float: left; margin: 0;}
+.flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
+.flex-control-thumbs img:hover {opacity: 1;}
+.flex-control-thumbs .flex-active {opacity: 1; cursor: default;}
+
+@media screen and (max-width: 860px) {
+ .flex-direction-nav .flex-prev {opacity: 1; left: 0;}
+ .flex-direction-nav .flex-next {opacity: 1; right: 0;}
+}
+
+/* Video */
+.fluid-width-video-wrapper {
+width: 100%;
+position: relative;
+padding: 0;
+}
+
+/* Captions */
+.flex-caption {
+width: 96%;
+padding: 2%;
+position: absolute;
+left: 0px;
+bottom: 0px;
+background: rgba(0, 0, 0, 0.6);
+color: white;
+text-align: center;
+text-shadow: rgba(0, 0, 0, 0.298039) 0px -1px 0px;
+font-size: 14px;
+line-height: 18px;
+}
+
+/* Fixes for using shortcode in Twenty Twelve Theme (and other Default themes) */
+.entry-content .flexslider > ul {
+ list-style: none;
+ margin: 0;
+ line-height: 0;
+}
+
+.entry-content .flexslider > ul > li {
+ margin: 0;
+}
+
+.entry-content .flexslider > ol {
+ margin: 0;
+}
+
+.entry-content .flexslider > ol > li {
+ margin: 0 6px;
+}
+
+p.flex-caption {
+ margin: 0;
+ margin-bottom: 0;
+ display: none;
+ font-weight: bold;
+}
+
+.entry-content .flexslider img {
+ max-width: 100%;
+}
+
+.flex-active-slide p.flex-caption {
+ display: block;
+}
View
165 includes/admin/meta-box.php
@@ -0,0 +1,165 @@
+<?php
+
+// Set Up Meta Box & Fields for Slides
+
+$slidecaption_1_metabox = array(
+ 'id' => 'slidecaption',
+ 'title' => 'Slider Settings',
+ 'page' => array('slides'),
+ 'context' => 'normal',
+ 'priority' => 'default',
+ 'fields' => array(
+
+
+ array(
+ 'name' => 'Slide Link',
+ 'desc' => 'Where you\'d like the slide to link to. If you leave this field blank the slide will not link anywhere.',
+ 'id' => 'ctslider_slidelink',
+ 'class' => 'ctslider_slidelink',
+ 'type' => 'text',
+ 'rich_editor' => 0,
+ 'max' => 0
+ ),
+
+ array(
+ 'name' => 'Caption Text',
+ 'desc' => 'If you\'d like to have a caption displayed with the slide, enter it here. If you leave this field blank, there will be no caption.',
+ 'id' => 'ctslider_captiontext',
+ 'class' => 'ctslider_captiontext',
+ 'type' => 'textarea',
+ 'rich_editor' => 0,
+ 'max' => 0
+ ),
+
+ array(
+ 'name' => 'Video Embed Code',
+ 'desc' => 'Paste here the iFrame Video Embed code. It will replace the image if you\'ve set one. If you\'re copying from Vimeo, make sure you don\'t include the text link below.',
+ 'id' => 'ctslider_videoembedcode',
+ 'class' => 'ctslider_videoembedcode',
+ 'type' => 'textarea',
+ 'rich_editor' => 0,
+ 'max' => 0
+ ),
+ )
+);
+
+add_action('admin_menu', 'ctslider_add_slidecaption_1_meta_box');
+function ctslider_add_slidecaption_1_meta_box() {
+
+ global $slidecaption_1_metabox;
+
+ foreach($slidecaption_1_metabox['page'] as $page) {
+ add_meta_box($slidecaption_1_metabox['id'], $slidecaption_1_metabox['title'], 'ctslider_show_slidecaption_1_box', $page, 'normal', 'default', $slidecaption_1_metabox);
+ }
+}
+
+// function to show meta boxes
+function ctslider_show_slidecaption_1_box() {
+ global $post;
+ global $slidecaption_1_metabox;
+ global $ctslider_prefix;
+ global $wp_version;
+
+ // Use nonce for verification
+ echo '<input type="hidden" name="ctslider_slidecaption_1_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
+
+ echo '<table class="form-table">';
+
+ foreach ($slidecaption_1_metabox['fields'] as $field) {
+ // get current post meta data
+
+ $meta = get_post_meta($post->ID, $field['id'], true);
+
+ echo '<tr>',
+ '<th style="width:20%"><label for="', $field['id'], '">', stripslashes($field['name']), '</label></th>',
+ '<td class="ctslider_field_type_' . str_replace(' ', '_', $field['type']) . '">';
+ switch ($field['type']) {
+ case 'text':
+ echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" /><br/>', '', stripslashes($field['desc']);
+ break;
+ case 'textarea':
+
+ if($field['rich_editor'] == 1) {
+ if($wp_version >= 3.3) {
+ echo wp_editor($meta, $field['id'], array('textarea_name' => $field['id']));
+ } else {
+ // older versions of WP
+ $editor = '';
+ if(!post_type_supports($post->post_type, 'editor')) {
+ $editor = wp_tiny_mce(true, array('editor_selector' => $field['class'], 'remove_linebreaks' => false) );
+ }
+ $field_html = '<div style="width: 97%; border: 1px solid #DFDFDF;"><textarea name="' . $field['id'] . '" class="' . $field['class'] . '" id="' . $field['id'] . '" cols="60" rows="8" style="width:100%">'. $meta . '</textarea></div><br/>' . __(stripslashes($field['desc']));
+ echo $editor . $field_html;
+ }
+ } else {
+ echo '<div style="width: 100%;"><textarea name="', $field['id'], '" class="', $field['class'], '" id="', $field['id'], '" cols="60" rows="8" style="width:97%">', $meta ? $meta : $field['std'], '</textarea></div>', '', stripslashes($field['desc']);
+ }
+
+ break;
+
+
+ }
+ echo '<td>',
+ '</tr>';
+ }
+
+ echo '</table>';
+}
+
+// Save data from meta box
+add_action('save_post', 'ctslider_slidecaption_1_save');
+function ctslider_slidecaption_1_save($post_id) {
+ global $post;
+ global $slidecaption_1_metabox;
+
+ // verify nonce
+ if (!wp_verify_nonce($_POST['ctslider_slidecaption_1_meta_box_nonce'], basename(__FILE__))) {
+ return $post_id;
+ }
+
+ // check autosave
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
+ return $post_id;
+ }
+
+ // check permissions
+ if ('page' == $_POST['post_type']) {
+ if (!current_user_can('edit_page', $post_id)) {
+ return $post_id;
+ }
+ } elseif (!current_user_can('edit_post', $post_id)) {
+ return $post_id;
+ }
+
+ foreach ($slidecaption_1_metabox['fields'] as $field) {
+
+ $old = get_post_meta($post_id, $field['id'], true);
+ $new = $_POST[$field['id']];
+
+ if ($new && $new != $old) {
+ if($field['type'] == 'date') {
+ $new = ctslider_format_date($new);
+ update_post_meta($post_id, $field['id'], $new);
+ } else {
+ if(is_string($new)) {
+ $new = $new;
+ }
+ update_post_meta($post_id, $field['id'], $new);
+
+
+ }
+ } elseif ('' == $new && $old) {
+ delete_post_meta($post_id, $field['id'], $old);
+ }
+ }
+}
+
+
+// Rename Post Thumbnail Meta Box
+add_action('do_meta_boxes', 'ctslider_change_image_box');
+function ctslider_change_image_box()
+{
+ remove_meta_box( 'postimagediv', 'slides', 'side' );
+ add_meta_box('postimagediv', __('Slide Image'), 'post_thumbnail_meta_box', 'slides', 'normal', 'high');
+
+}
View
51 includes/admin/post-types.php
@@ -0,0 +1,51 @@
+<?php
+
+// Register Slides Post Type
+
+function ctslider_register_slides_posttype() {
+ $labels = array(
+ 'name' => _x( 'Slides', 'post type general name' ),
+ 'singular_name' => _x( 'Slide', 'post type singular name' ),
+ 'add_new' => __( 'Add New Slide' ),
+ 'add_new_item' => __( 'Slide' ),
+ 'edit_item' => __( 'Edit Slide' ),
+ 'new_item' => __( 'New Slide' ),
+ 'view_item' => __( 'View Slide' ),
+ 'search_items' => __( 'Search Slides' ),
+ 'not_found' => __( 'No Slides Found' ),
+ 'not_found_in_trash'=> __( 'No Slides Found In Trash' ),
+ 'parent_item_colon' => __( 'Parent Slide' ),
+ 'menu_name' => __( 'All Slides' )
+ );
+
+ $taxonomies = array();
+
+ $supports = array( 'title', 'thumbnail', 'page-attributes' );
+
+ $post_type_args = array(
+ 'labels' => $labels,
+ 'singular_label' => __( 'Slide' ),
+ 'public' => true,
+ 'show_ui' => true,
+ 'publicly_queryable'=> true,
+ 'query_var' => true,
+ 'capability_type' => 'post',
+ 'has_archive' => false,
+ 'hierarchical' => false,
+ 'rewrite' => array( 'slug' => 'slides', 'with_front' => false ),
+ 'supports' => $supports,
+ 'menu_position' => 28,
+ 'menu_icon' => CTSLIDER_PLUGIN_URL . 'assets/images/icon.png',
+ 'taxonomies' => $taxonomies
+ );
+ register_post_type( 'slides',$post_type_args );
+}
+add_action( 'init', 'ctslider_register_slides_posttype' );
+
+// Rename Slider Main Menu Title
+function ctslider_edit_admin_menus() {
+ global $menu;
+ global $submenu;
+ $menu[28][0] = 'Captain Slider';
+}
+add_action( 'admin_menu', 'ctslider_edit_admin_menus' );
View
442 includes/admin/settings.php
@@ -0,0 +1,442 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| SETTINGS PAGE
+|--------------------------------------------------------------------------
+*/
+
+function ctslider_options_each( $key ) {
+
+ $slider_options = get_option( 'ctslider_all_options' );
+
+ /* Define the array of defaults */
+ $defaults = array(
+ 'width' => 0,
+ 'height' => 0,
+ 'effect' => 'fade',
+ 'bullets' => 0,
+ 'arrows' => 0,
+ 'slidelength' => 6000,
+ 'animationlength' => 600,
+ 'automatic' => 0,
+ 'donation' => 0
+ );
+
+ $slider_options = wp_parse_args( $slider_options, $defaults );
+
+ if( isset($slider_options[$key]) )
+ return $slider_options[$key];
+
+ return false;
+}
+
+
+
+/**
+ * This function introduces the theme options into the 'Appearance' menu and into a top-level
+ * 'Sandbox Theme' menu.
+ */
+function ctslider_example_theme_menu() {
+
+ add_submenu_page(
+ 'edit.php?post_type=slides', // The ID of the top-level menu page to which this submenu item belongs
+ 'Captain Slider Settings', // The value used to populate the browser's title bar when the menu page is active
+ 'Settings', // The label of this submenu item displayed in the menu
+ 'administrator', // What roles are able to access this submenu item

You should really change this to manage_options but it's your call.

@bryceadams Owner

Which part? Sorry, so early and not processing properly yet

@bryceadams Owner

ohh the role. yeah good point i'm going to change that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ 'ctslider_all_options', // The ID used to represent this submenu item
+ 'ctslider_theme_display' // The callback function used to render the options for this submenu item
+ );
+
+
+} // end ctslider_example_theme_menu
+add_action( 'admin_menu', 'ctslider_example_theme_menu' );
+
+/**
+ * Renders a simple page to display for the theme menu defined above.
+ */
+function ctslider_theme_display( $active_tab = '' ) {
+?>
+ <!-- Create a header in the default WordPress 'wrap' container -->

Everything should be sent through an output buffer.

@bryceadams Owner

Yeah haha I've got to remember to add those. Will fix that all up now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <div class="wrap">
+
+ <div id="icon-themes" class="icon32"></div>
+ <h2>Captain Slider Settings</h2>

Best to localise this text. Change to <?php _e( 'Captain Slider Settings' ); ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <?php settings_errors(); ?>
+
+ <?php if( isset( $_GET[ 'tab' ] ) ) {
+ $active_tab = $_GET[ 'tab' ];
+ } else {
+ $active_tab = 'display_options';
+ } // end if/else ?>
+
+ <?php
+ $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>Documentation</h3>

Again best to localise this.

@bryceadams Owner

Yeah, fixing up now. Thanks for taking a look through it all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <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' );
+
+ } // end if/else
+
+ submit_button();
+
+} // end ctslider_theme_display
+
+/* ------------------------------------------------------------------------ *
+ * Setting Registration
+ * ------------------------------------------------------------------------ */
+
+/**
+ * Initializes the theme's display options page by registering the Sections,
+ * Fields, and Settings.
+ *
+ * This function is registered with the 'admin_init' hook.
+ */
+function ctslider_initialize_theme_options() {
+
+ // If the theme options don't exist, create them.
+ if( false == get_option( 'ctslider_all_options' ) ) {
+ add_option( 'ctslider_all_options' );
+ } // end if
+
+ // First, we register a section. This is necessary since all future options must belong to a
+ add_settings_section(
+ 'general_settings_section',
+ __( 'Settings', 'ctslider' ),
+ 'ctslider_general_options_callback',
+ 'ctslider_all_options'
+ );
+
+ // Slide Width
+ add_settings_field(
+ 'width',
+ __( 'Width (px)', 'ctslider' ),
+ 'ctslider_width_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Slide Height
+ add_settings_field(
+ 'height',
+ __( 'Height (px)', 'ctslider' ),
+ 'ctslider_height_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Note
+ add_settings_field(
+ 'note',
+ '',
+ 'ctslider_note_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Slide Effect / Animation
+ add_settings_field(
+ 'effect',
+ __( 'Slide Effect / Animation', 'ctslider' ),
+ 'ctslider_effect_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Note #2
+ add_settings_field(
+ 'note2',
+ '',
+ 'ctslider_note2_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Slide Nav Bullets
+ add_settings_field(
+ 'bullets',
+ __( 'Hide Bullets', 'ctslider' ),
+ 'ctslider_bullets_callback',
+ 'ctslider_all_options',
+ 'general_settings_section',
+ array(
+ __( 'Check the box to hide the slide bullets.', 'ctslider' )
+ )
+ );
+
+ // Slide Nav Arrows
+ add_settings_field(
+ 'arrows',
+ __( 'Hide Navigation Arrows', 'ctslider' ),
+ 'ctslider_arrows_callback',
+ 'ctslider_all_options',
+ 'general_settings_section',
+ array(
+ __( 'Check the box to hide the navigation arrows.', 'ctslider' )
+ )
+ );
+
+ /***/
+
+ // Slide Display Length
+ add_settings_field(
+ 'slidelength',
+ __( 'Slide Length (ms)', 'ctslider' ),
+ 'ctslider_slidelength_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Animation Display Length
+ add_settings_field(
+ 'animationlength',
+ __( 'Animation Length (ms)', 'ctslider' ),
+ 'ctslider_animationlength_callback',
+ 'ctslider_all_options',
+ 'general_settings_section'
+ );
+
+ // Slider Automatic Play
+ add_settings_field(
+ 'automatic',
+ __( 'No Automatic Start', 'ctslider' ),
+ 'ctslider_automatic_callback',
+ 'ctslider_all_options',
+ 'general_settings_section',
+ array(
+ __( 'If the box is checked the slider will not automatically start/play.', 'ctslider' )
+ )
+ );
+
+ // Hide Donation Link
+ add_settings_field(
+ 'donation',
+ __( 'Hide Donation Link', 'ctslider' ),
+ 'ctslider_donation_callback',
+ 'ctslider_all_options',
+ 'general_settings_section',
+ array(
+ __( 'Tick this box to hide the donation link above. ANY donations are appreciated!', 'ctslider' )
+ )
+ );
+
+ // Finally, we register the fields with WordPress
+ register_setting(
+ 'ctslider_all_options',
+ 'ctslider_all_options'
+ );
+
+
+} // end ctslider_initialize_theme_options
+add_action( 'admin_init', 'ctslider_initialize_theme_options' );
+
+
+
+/* ------------------------------------------------------------------------ *
+ * Section Callbacks
+ * ------------------------------------------------------------------------ */
+
+/**
+ * This function provides a simple description for the General Options page.
+ *
+ * It's called from the 'ctslider_initialize_theme_options' function by being passed as a parameter
+ * in the add_settings_section function.
+ */
+function ctslider_general_options_callback() {
+ echo '<p>';
+ _e( 'You can use the following settings to configure the Captain Slider.', 'ctslider' );
+ echo '</p>';
+} // end ctslider_general_options_callback
+
+/* ------------------------------------------------------------------------ *
+ * Field Callbacks
+ * ------------------------------------------------------------------------ */
+
+/**
+ * This function renders the interface elements for toggling the visibility of the header element.
+ *
+ * It accepts an array or arguments and expects the first element in the array to be the description
+ * to be displayed next to the checkbox.
+ */
+
+function ctslider_width_callback() {
+
+ $options = get_option( 'ctslider_all_options' );
+
+ $url = '';
+ if( isset( $options['width'] ) ) {
+ $url = intval( $options['width'] );
+ } // end if
+
+ // Render the output
+ echo '<input type="text" id="width" name="ctslider_all_options[width]" value="' . $url . '" /><label for="width">&nbsp;';
+ _e( 'If left at 0, the original image size will be used.', 'ctslider' );
+ echo '</label>';
+
+} // end ctslider_width_callback
+
+function ctslider_height_callback() {
+
+ // First, we read the social options collection
+ $options = get_option( 'ctslider_all_options' );
+
+ // Next, we need to make sure the element is defined in the options. If not, we'll set an empty string.
+ $url = '';
+ if( isset( $options['height'] ) ) {
+ $url = intval( $options['height'] );
+ } // end if
+
+ // Render the output
+ echo '<input type="text" id="height" name="ctslider_all_options[height]" value="' . $url . '" /><label for="height">&nbsp;';
+ _e( 'If left at 0, the original image size will be used.', 'ctslider' );
+ echo '</label>';
+
+} // end ctslider_height_callback
+
+function ctslider_note_callback() {
+
+ _e( 'If you change the width/height above, you will need to regenerate the slider images.', 'ctslider' );
+ echo '<br/>';
+ _e( 'Either <strong>Install the <a href="http://cpthe.me/regenerate/">Regenate Thumbnails</a> Plugin</strong> or reupload your slides.', 'ctslider' );
+
+} // end ctslider_note_callback
+
+function ctslider_effect_callback() {
+
+ $options = get_option( 'ctslider_all_options' );
+
+ $html = '<select id="effect" name="ctslider_all_options[effect]">';
+ $html .= '<option value="fade"' . selected( $options['effect'], 'fade', false) . '>' . __( 'Fade', 'ctslider' ) . '</option>';
+ $html .= '<option value="slideh"' . selected( $options['effect'], 'slideh', false) . '>' . __( 'Slide Horizontal', 'ctslider' ) . '</option>';
+ $html .= '<option value="slidev"' . selected( $options['effect'], 'slidev', false) . '>' . __( 'Slide Vertical', 'ctslider' ) . '</option>';
+ $html .= '</select>';
+
+ echo $html;
+
+} // end ctslider_effect_callback
+
+function ctslider_note2_callback() {
+
+ _e( 'If you select Slide Vertical, your slides must all share the same height or they will display strangely.', 'ctslider' );
+
+} // end ctslider_note2_callback
+
+function ctslider_bullets_callback($args) {
+
+ $options = get_option('ctslider_all_options');
+
+ $html = '<input type="checkbox" id="bullets" name="ctslider_all_options[bullets]" value="1" ' . checked( 1, isset( $options['bullets'] ) ? $options['bullets'] : 0, false ) . '/>';
+
+ $html .= '<label for="bullets">&nbsp;' . $args[0] . '</label>';
+
+ echo $html;
+
+} // end ctslider_bullets_callback
+
+function ctslider_arrows_callback($args) {
+
+ $options = get_option('ctslider_all_options');
+
+ $html = '<input type="checkbox" id="arrows" name="ctslider_all_options[arrows]" value="1" ' . checked( 1, isset( $options['arrows'] ) ? $options['arrows'] : 0, false ) . '/>';
+ $html .= '<label for="arrows">&nbsp;' . $args[0] . '</label>';
+
+ echo $html;
+
+} // end ctslider_arrows_callback
+
+function ctslider_slidelength_callback() {
+
+ $options = get_option( 'ctslider_all_options' );
+
+ $url = '';
+ if( isset( $options['slidelength'] ) ) {
+ $url = intval( $options['slidelength'] );
+ } else {
+ $url = 6000; // default value
+ }
+
+ // Render the output
+ echo '<input type="text" id="slidelength" name="ctslider_all_options[slidelength]" value="' . $url . '" /><label for="slidelength">&nbsp;';
+ _e( 'Length each slide will play for in milliseconds. Default is 6000.', 'ctslider' );
+ echo '</label>';
+
+} // end ctslider_slidelength_callback
+
+
+function ctslider_animationlength_callback() {
+
+ $options = get_option( 'ctslider_all_options' );
+
+ $url = '';
+ if( isset( $options['animationlength'] ) ) {
+ $url = intval( $options['animationlength'] );
+ } else {
+ $url = 600; // default value
+ }
+
+ // Render the output
+ echo '<input type="text" id="animationlength" name="ctslider_all_options[animationlength]" value="' . $url . '" /><label for="animationlength">&nbsp;';
+ _e( 'Length the slide animation/effect will go for in milliseconds. Default is 600.', 'ctslider' );
+ echo '</label>';
+
+} // end ctslider_animationlength_callback
+
+
+function ctslider_automatic_callback($args) {
+
+ $options = get_option('ctslider_all_options');
+
+ $html = '<input type="checkbox" id="automatic" name="ctslider_all_options[automatic]" value="1" ' . checked( 1, isset( $options['automatic'] ) ? $options['automatic'] : 0, false ) . '/>';
+
+ $html .= '<label for="automatic">&nbsp;' . $args[0] . '</label>';
+
+ echo $html;
+
+} // end ctslider_automatic_callback
+
+
+function ctslider_donation_callback($args) {
+
+ $options = get_option('ctslider_all_options');
+
+ $html = '<input type="checkbox" id="donation" name="ctslider_all_options[donation]" value="1" ' . checked( 1, isset( $options['donation'] ) ? $options['donation'] : 0, false ) . '/>';
+
+ $html .= '<label for="donation">&nbsp;' . $args[0] . '</label>';
+
+ echo $html;
+
+} // end ctslider_automatic_callback
+
+
+function ctslider_textarea_element_callback() {
+
+ $options = get_option( 'ctslider_all_options' );
+
+ // Render the output
+ echo '<textarea id="textarea_example" name="ctslider_all_options[textarea_example]" rows="5" cols="50">' . $options['textarea_example'] . '</textarea>';
+
+} // end ctslider_textarea_element_callback
+
+
+// omit closing PHP tag for posterity (I honestly don't even know what that means - just sounds cool and important I guess)
View
107 includes/admin/sorter.php
@@ -0,0 +1,107 @@
+<?php
+
+// Custom Drag/Drop Ordering Interface
+add_action( 'admin_menu', 'ctslider_register_slides_menu' );
+
+function ctslider_register_slides_menu() {
+ add_submenu_page(
+ 'edit.php?post_type=slides',
+ 'Slider Sorter',
+ 'Sorter',
+ 'edit_pages', 'slides-order',
+ 'ctslider_slides_order_page'
+ );
+}
+
+
+function ctslider_slides_order_page() {
+?>
+ <div class="wrap">
+ <h2>Sort Slides</h2>
+ <p>Simply drag the slides up or down and they will be saved in that order.</p>
+ <?php $slides = new WP_Query( array( 'post_type' => 'slides', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order' ) ); ?>
+ <?php if( $slides->have_posts() ) : ?>
+
+ <table class="wp-list-table widefat fixed posts" id="sortable-table">
+ <thead>
+ <tr>
+ <th class="column-order">Order</th>
+ <th class="column-thumbnail">Slide Image</th>
+ <th class="column-title">Title</th>
+ </tr>
+ </thead>
+ <tbody data-post-type="slide">
+ <?php while( $slides->have_posts() ) : $slides->the_post(); ?>
+ <tr id="post-<?php the_ID(); ?>">
+ <td class="column-order"><img src="<?php echo CTSLIDER_PLUGIN_URL . 'assets/images/move.svg'; ?>" title="" alt="Move Icon" width="20" height="20" class="" /></td>
+ <td class="column-thumbnail"><?php the_post_thumbnail( 'admin-list-thumb' ); ?></td>
+ <td class="column-title"><strong><?php the_title(); ?></strong><div class="excerpt"><em><?php echo get_post_meta( get_the_id(), 'ctslider_captiontext', true); ?></em></div></td>
+ </tr>
+ <?php endwhile; ?>
+ </tbody>
+ <tfoot>
+ <tr>
+ <th class="column-order">Order</th>
+ <th class="column-thumbnail">Slide Image</th>
+ <th class="column-title">Title</th>
+ </tr>
+ </tfoot>
+
+ </table>
+
+ <?php else: ?>
+
+ <p>No slides found, why not <a href="post-new.php?post_type=slides">create one?</a></p>
+
+ <?php endif; ?>
+ <?php wp_reset_postdata(); // Don't forget to reset again! ?>
+
+ <style>
+ /* Dodgy CSS ^_^ */
+ #sortable-table td { background: white; }
+ #sortable-table .column-order { padding: 3px 10px; width: 50px; }
+ #sortable-table .column-order img { cursor: move; }
+ #sortable-table td.column-order { vertical-align: middle; text-align: center; }
+ /*#sortable-table td.column-title {vertical-align: middle; }*/
+ #sortable-table .column-thumbnail { width: 100px; }
+ </style>
+
+ </div><!-- .wrap -->
+
+<?php
+
+}
+
+
+// jQuery UI
+add_action( 'admin_enqueue_scripts', 'ctslider_admin_enqueue_scripts' );
+
+function ctslider_admin_enqueue_scripts() {
+ wp_enqueue_script( 'jquery-ui-sortable' );
+ wp_enqueue_script( 'ctslider-admin-scripts', CTSLIDER_PLUGIN_URL . 'js/admin-scripts.js' );
+}
+
+
+// AJAX Callbacks
+add_action( 'wp_ajax_ctslider_update_post_order', 'ctslider_update_post_order' );
+
+function ctslider_update_post_order() {
+ global $wpdb;
+
+ $post_type = $_POST['postType'];
+ $order = $_POST['order'];
+
+ /**
+ * Expect: $sorted = array(
+ * menu_order => post-XX
+ * );
+ */
+ foreach( $order as $menu_order => $post_id )
+ {
+ $post_id = intval( str_ireplace( 'post-', '', $post_id ) );
+ $menu_order = intval($menu_order);
+ wp_update_post( array( 'ID' => $post_id, 'menu_order' => $menu_order ) );
+ }
+
+ die( '1' );
+}
View
55 includes/admin/taxonomy.php
@@ -0,0 +1,55 @@
+<?php
+
+/*------------------------------------*\
+ Register Slider Taxonomy
+\*------------------------------------*/
+
+function ctslider_register_slider_tax() {
+ $labels = array(
+ 'name' => _x( 'Sliders', 'taxonomy general name' ),
+ 'singular_name' => _x( 'Slider', 'taxonomy singular name' ),
+ 'add_new' => _x( 'Add New Slider', 'Slider'),
+ 'add_new_item' => __( 'Add New Slider' ),
+ 'edit_item' => __( 'Edit Slider' ),
+ 'new_item' => __( 'New Slider' ),
+ 'view_item' => __( 'View Slider' ),
+ 'search_items' => __( 'Search Sliders' ),
+ 'not_found' => __( 'No Slider found' ),
+ 'not_found_in_trash' => __( 'No Slider found in Trash' ),
+ 'menu_name' => __( 'Slider Manager' )
+ );
+
+ $pages = array('slides');
+
+ $args = array(
+ 'labels' => $labels,
+ 'singular_label' => __('Slider'),
+ 'public' => true,
+ 'show_ui' => true,
+ 'query_var' => true,
+ 'hierarchical' => false,
+ 'show_tagcloud' => false,
+ 'show_in_nav_menus' => false,
+ 'rewrite' => array('slug' => 'slider', 'with_front' => false ),
+ );
+ register_taxonomy('slider', $pages, $args);
+}
+add_action('init', 'ctslider_register_slider_tax');
+
+
+/*------------------------------------*\
+ Modify Slider Taxonomy Page - Adding Column for ID
+\*------------------------------------*/
+
+add_filter('manage_edit-slider_columns', 'ctslider_slider_columns', 5);
+add_action('manage_slider_custom_column', 'ctslider_slider_custom_columns', 5, 3);
+function ctslider_slider_columns($defaults) {
+ $defaults['ctslider_slider_ids'] = __('ID');
+ return $defaults;
+}
+
+function ctslider_slider_custom_columns($value, $column_name, $id) {
+ if( $column_name == 'ctslider_slider_ids' ) {
+ return (int)$id;
+ }
+}
View
151 includes/admin/ui.php
@@ -0,0 +1,151 @@
+<?php
+
+/*------------------------------------*\
+ Add Custom Taxonomy Filter (via yoast.com)
+\*------------------------------------*/
+
+// Filter the request to just give posts for the given taxonomy, if applicable.
+function ctslider_taxonomy_filter_restrict_manage_posts() {
+ global $typenow;
+
+ // If you only want this to work for your specific post type,
+ // check for that $type here and then return.
+ // This function, if unmodified, will add the dropdown for each
+ // post type / taxonomy combination.
+
+ $post_types = get_post_types( array( '_builtin' => false ) );
+
+ if ( in_array( $typenow, $post_types ) ) {
+ $filters = get_object_taxonomies( $typenow );
+
+ foreach ( $filters as $tax_slug ) {
+ $tax_obj = get_taxonomy( $tax_slug );
+ wp_dropdown_categories( array(
+ 'show_option_all' => __('Show All '.$tax_obj->label ),
+ 'taxonomy' => $tax_slug,
+ 'name' => $tax_obj->name,
+ 'orderby' => 'name',
+ 'selected' => $_GET[$tax_slug],
+ 'hierarchical' => $tax_obj->hierarchical,
+ 'show_count' => false,
+ 'hide_empty' => true
+ ) );
+ }
+ }
+}
+
+add_action( 'restrict_manage_posts', 'ctslider_taxonomy_filter_restrict_manage_posts' );
+
+
+function ctslider_taxonomy_filter_post_type_request( $query ) {
+ global $pagenow, $typenow;
+
+ if ( 'edit.php' == $pagenow ) {
+ $filters = get_object_taxonomies( $typenow );
+ foreach ( $filters as $tax_slug ) {
+ $var = &$query->query_vars[$tax_slug];
+ if ( isset( $var ) ) {
+ $term = get_term_by( 'id', $var, $tax_slug );
+ $var = $term->slug;
+ }
+ }
+ }
+}
+
+add_filter( 'parse_query', 'ctslider_taxonomy_filter_post_type_request' );
+
+
+/*------------------------------------*\
+ Add Slider Images as Column for Slider Post Type
+\*------------------------------------*/
+
+// Create Image Size for Thumbnails
+add_image_size( 'admin-list-thumb', 50, 50, true );
+
+// Add the posts and pages columns filter. They can both use the same function.
+add_filter('manage_slides_posts_columns', 'ctslider_add_remove_column', 5);
+
+// Add the column
+function ctslider_add_remove_column($cols){
+
+ // Custom Column Position
+ $colsstart = array_slice( $cols, 0, 1, true );
+ $colsend = array_slice( $cols, 1, null, true );
+
+ // Add Thumbnail Column
+ $cols = array_merge(
+ $colsstart,
+ array( 'ctslider_post_thumb' => __( 'Slide Image' ) ),
+ $colsend
+ );
+ //$cols['ctslider_post_thumb'] = __( 'Slide Image' );
+
+ // Remove Date Column
+ unset( $cols['date'] );
+
+ return $cols;
+
+}
+
+// Hook into the posts an pages column managing. Sharing function callback again.
+add_action('manage_slides_posts_custom_column', 'ctslider_display_post_thumbnail_column', 5, 2);
+
+// Grab featured-thumbnail size post thumbnail and display it.
+function ctslider_display_post_thumbnail_column($col, $id){
+ switch($col){
+ case 'ctslider_post_thumb':
+ if( function_exists('the_post_thumbnail') )
+ echo the_post_thumbnail( 'admin-list-thumb' );
+ else
+ echo 'Enable Thumbnails!';
+ break;
+ }
+}
+
+
+/*------------------------------------*\
+ Add Order Column (menu_order)
+\*------------------------------------*/
+
+// Add The Column
+function ctslider_add_new_slides_column($slides_columns) {
+ $slides_columns['menu_order'] = "Order";
+ return $slides_columns;
+}
+add_action('manage_edit-slides_columns', 'ctslider_add_new_slides_column');
+
+// Show Custom Order Values
+function ctslider_show_order_column($name){
+ global $post;
+
+ switch ($name) {
+ case 'menu_order':
+ $order = $post->menu_order;
+ echo $order;
+ break;
+ default:
+ break;
+ }
+}
+add_action('manage_slides_posts_custom_column','ctslider_show_order_column');
+
+// Make It Sortable
+function ctslider_order_column_register_sortable($columns){
+ $columns['menu_order'] = 'menu_order';
+ return $columns;
+}
+add_filter('manage_edit-slides_sortable_columns','ctslider_order_column_register_sortable');
+
+// Presets Slides Order to be menu_order
+function ctslider_set_custom_post_types_admin_order($wp_query) {
+ if (is_admin()) {
+ // Get the post type from the query
+ $post_type = $wp_query->query['post_type'];
+ // if it's one of our custom ones
+ if ( $post_type == 'slides') {
+ $wp_query->set('orderby', 'menu_order');
+ $wp_query->set('order', 'ASC');
+ }
+ }
+}
+add_filter('pre_get_posts', 'ctslider_set_custom_post_types_admin_order');
View
11 includes/front-end/custom-size.php
@@ -0,0 +1,11 @@
+<?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
View
19 includes/front-end/shortcode.php
@@ -0,0 +1,19 @@
+<?php
+
+// Slider Shortcode
+
+function ctslider_slider_shortcode( $atts, $content = null ) {
+ extract( shortcode_atts( array(
+ 'id' => ''
+ ), $atts ) );
+
+ ob_start();
+ ctslider_slider_template( $id );
+ $output = ob_get_clean();
+ return $output;
+}
+add_shortcode( 'slider', 'ctslider_slider_shortcode' );
+
+
+
+
View
91 includes/front-end/template.php
@@ -0,0 +1,91 @@
+<?php
+
+// Create Slider
+
+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() ) {
+
+ // Start the Slider ?>
+ <div class="flexslider">
+ <ul class="slides">
+
+ <?php
+ //$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
+ //data-thumb="<?php echo $thumb; ? >"
+ // The Loop
+ while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
+ <li>
+
+ <?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 ) != '' ) { ?>
+ <!-- The Slide's 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 } ?>
+
+ <!-- The Slide's Caption -->
+ <?php
+ 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 endwhile; ?>
+
+ </ul><!-- .slides -->
+ </div><!-- .flexslider -->
+
+ <?php }
+
+ // Reset Post Data
+ wp_reset_postdata();
+}
View
21 js/admin-scripts.js
@@ -0,0 +1,21 @@
+jQuery(function($) {
+
+ $('#sortable-table tbody').sortable({
+ axis: 'y',
+ handle: '.column-order img',
+ placeholder: 'ui-state-highlight',
+ forcePlaceholderSize: true,
+ update: function(event, ui) {
+ var theOrder = $(this).sortable('toArray');
+
+ var data = {
+ action: 'ctslider_update_post_order',
+ postType: $(this).attr('data-post-type'),
+ order: theOrder
+ };
+
+ $.post(ajaxurl, data);
+ }
+ }).disableSelection();
+
+});
View
77 js/jquery.fitvids.js
@@ -0,0 +1,77 @@
+/*global jQuery */
+/*!
+* FitVids 1.0
+*
+* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
+* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
+* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
+*
+* Date: Thu Sept 01 18:00:00 2011 -0500
+*/
+
+(function( $ ){
+
+ $.fn.fitVids = function( options ) {
+ var settings = {
+ customSelector: null
+ }
+
+ var div = document.createElement('div'),
+ ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
+
+ div.className = 'fit-vids-style';
+ div.innerHTML = '&shy;<style> \
+ .fluid-width-video-wrapper { \
+ width: 100%; \
+ position: relative; \
+ padding: 0; \
+ } \
+ \
+ .fluid-width-video-wrapper iframe, \
+ .fluid-width-video-wrapper object, \
+ .fluid-width-video-wrapper embed { \
+ position: absolute; \
+ top: 0; \
+ left: 0; \
+ width: 100%; \
+ height: 100%; \
+ } \
+ </style>';
+
+ ref.parentNode.insertBefore(div,ref);
+
+ if ( options ) {
+ $.extend( settings, options );
+ }
+
+ return this.each(function(){
+ var selectors = [
+ "iframe[src*='player.vimeo.com']",
+ "iframe[src*='www.youtube.com']",
+ "iframe[src*='www.kickstarter.com']",
+ "object",
+ "embed"
+ ];
+
+ if (settings.customSelector) {
+ selectors.push(settings.customSelector);
+ }
+
+ var $allVideos = $(this).find(selectors.join(','));
+
+ $allVideos.each(function(){
+ var $this = $(this);
+ if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
+ var height = ( this.tagName.toLowerCase() == 'object' || $this.attr('height') ) ? $this.attr('height') : $this.height(),
+ width = $this.attr('width') ? $this.attr('width') : $this.width(),
+ aspectRatio = height / width;
+ if(!$this.attr('id')){
+ var videoID = 'fitvid' + Math.floor(Math.random()*999999);
+ $this.attr('id', videoID);
+ }
+ $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
+ $this.removeAttr('height').removeAttr('width');
+ });
+ });
+ }
+})( jQuery );
View
38 js/jquery.flexslider-min.js
@@ -0,0 +1,38 @@
+/*
+ * jQuery FlexSlider v2.1
+ * Copyright 2012 WooThemes
+ * Contributing Author: Tyler Smith
+ */
+;(function(d){d.flexslider=function(i,k){var a=d(i),c=d.extend({},d.flexslider.defaults,k),e=c.namespace,p="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,t=p?"touchend":"click",l="vertical"===c.direction,m=c.reverse,h=0<c.itemWidth,r="fade"===c.animation,s=""!==c.asNavFor,f={};d.data(i,"flexslider",a);f={init:function(){a.animating=!1;a.currentSlide=c.startAt;a.animatingTo=a.currentSlide;a.atEnd=0===a.currentSlide||a.currentSlide===a.last;a.containerSelector=c.selector.substr(0,
+ c.selector.search(" "));a.slides=d(c.selector,a);a.container=d(a.containerSelector,a);a.count=a.slides.length;a.syncExists=0<d(c.sync).length;"slide"===c.animation&&(c.animation="swing");a.prop=l?"top":"marginLeft";a.args={};a.manualPause=!1;var b=a,g;if(g=!c.video)if(g=!r)if(g=c.useCSS)a:{g=document.createElement("div");var n=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"],e;for(e in n)if(void 0!==g.style[n[e]]){a.pfx=n[e].replace("Perspective","").toLowerCase();
+ a.prop="-"+a.pfx+"-transform";g=!0;break a}g=!1}b.transitions=g;""!==c.controlsContainer&&(a.controlsContainer=0<d(c.controlsContainer).length&&d(c.controlsContainer));""!==c.manualControls&&(a.manualControls=0<d(c.manualControls).length&&d(c.manualControls));c.randomize&&(a.slides.sort(function(){return Math.round(Math.random())-0.5}),a.container.empty().append(a.slides));a.doMath();s&&f.asNav.setup();a.setup("init");c.controlNav&&f.controlNav.setup();c.directionNav&&f.directionNav.setup();c.keyboard&&
+ (1===d(a.containerSelector).length||c.multipleKeyboard)&&d(document).bind("keyup",function(b){b=b.keyCode;if(!a.animating&&(39===b||37===b))b=39===b?a.getTarget("next"):37===b?a.getTarget("prev"):!1,a.flexAnimate(b,c.pauseOnAction)});c.mousewheel&&a.bind("mousewheel",function(b,g){b.preventDefault();var d=0>g?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(d,c.pauseOnAction)});c.pausePlay&&f.pausePlay.setup();c.slideshow&&(c.pauseOnHover&&a.hover(function(){!a.manualPlay&&!a.manualPause&&a.pause()},
+ function(){!a.manualPause&&!a.manualPlay&&a.play()}),0<c.initDelay?setTimeout(a.play,c.initDelay):a.play());p&&c.touch&&f.touch();(!r||r&&c.smoothHeight)&&d(window).bind("resize focus",f.resize);setTimeout(function(){c.start(a)},200)},asNav:{setup:function(){a.asNav=!0;a.animatingTo=Math.floor(a.currentSlide/a.move);a.currentItem=a.currentSlide;a.slides.removeClass(e+"active-slide").eq(a.currentItem).addClass(e+"active-slide");a.slides.click(function(b){b.preventDefault();var b=d(this),g=b.index();
+ !d(c.asNavFor).data("flexslider").animating&&!b.hasClass("active")&&(a.direction=a.currentItem<g?"next":"prev",a.flexAnimate(g,c.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){a.manualControls?f.controlNav.setupManual():f.controlNav.setupPaging()},setupPaging:function(){var b=1,g;a.controlNavScaffold=d('<ol class="'+e+"control-nav "+e+("thumbnails"===c.controlNav?"control-thumbs":"control-paging")+'"></ol>');if(1<a.pagingCount)for(var n=0;n<a.pagingCount;n++)g="thumbnails"===c.controlNav?
+ '<img src="'+a.slides.eq(n).attr("data-thumb")+'"/>':"<a>"+b+"</a>",a.controlNavScaffold.append("<li>"+g+"</li>"),b++;a.controlsContainer?d(a.controlsContainer).append(a.controlNavScaffold):a.append(a.controlNavScaffold);f.controlNav.set();f.controlNav.active();a.controlNavScaffold.delegate("a, img",t,function(b){b.preventDefault();var b=d(this),g=a.controlNav.index(b);b.hasClass(e+"active")||(a.direction=g>a.currentSlide?"next":"prev",a.flexAnimate(g,c.pauseOnAction))});p&&a.controlNavScaffold.delegate("a",
+ "click touchstart",function(a){a.preventDefault()})},setupManual:function(){a.controlNav=a.manualControls;f.controlNav.active();a.controlNav.live(t,function(b){b.preventDefault();var b=d(this),g=a.controlNav.index(b);b.hasClass(e+"active")||(g>a.currentSlide?a.direction="next":a.direction="prev",a.flexAnimate(g,c.pauseOnAction))});p&&a.controlNav.live("click touchstart",function(a){a.preventDefault()})},set:function(){a.controlNav=d("."+e+"control-nav li "+("thumbnails"===c.controlNav?"img":"a"),
+ a.controlsContainer?a.controlsContainer:a)},active:function(){a.controlNav.removeClass(e+"active").eq(a.animatingTo).addClass(e+"active")},update:function(b,c){1<a.pagingCount&&"add"===b?a.controlNavScaffold.append(d("<li><a>"+a.count+"</a></li>")):1===a.pagingCount?a.controlNavScaffold.find("li").remove():a.controlNav.eq(c).closest("li").remove();f.controlNav.set();1<a.pagingCount&&a.pagingCount!==a.controlNav.length?a.update(c,b):f.controlNav.active()}},directionNav:{setup:function(){var b=d('<ul class="'+
+ e+'direction-nav"><li><a class="'+e+'prev" href="#">'+c.prevText+'</a></li><li><a class="'+e+'next" href="#">'+c.nextText+"</a></li></ul>");a.controlsContainer?(d(a.controlsContainer).append(b),a.directionNav=d("."+e+"direction-nav li a",a.controlsContainer)):(a.append(b),a.directionNav=d("."+e+"direction-nav li a",a));f.directionNav.update();a.directionNav.bind(t,function(b){b.preventDefault();b=d(this).hasClass(e+"next")?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(b,c.pauseOnAction)});
+ p&&a.directionNav.bind("click touchstart",function(a){a.preventDefault()})},update:function(){var b=e+"disabled";1===a.pagingCount?a.directionNav.addClass(b):c.animationLoop?a.directionNav.removeClass(b):0===a.animatingTo?a.directionNav.removeClass(b).filter("."+e+"prev").addClass(b):a.animatingTo===a.last?a.directionNav.removeClass(b).filter("."+e+"next").addClass(b):a.directionNav.removeClass(b)}},pausePlay:{setup:function(){var b=d('<div class="'+e+'pauseplay"><a></a></div>');a.controlsContainer?
+ (a.controlsContainer.append(b),a.pausePlay=d("."+e+"pauseplay a",a.controlsContainer)):(a.append(b),a.pausePlay=d("."+e+"pauseplay a",a));f.pausePlay.update(c.slideshow?e+"pause":e+"play");a.pausePlay.bind(t,function(b){b.preventDefault();d(this).hasClass(e+"pause")?(a.manualPause=!0,a.manualPlay=!1,a.pause()):(a.manualPause=!1,a.manualPlay=!0,a.play())});p&&a.pausePlay.bind("click touchstart",function(a){a.preventDefault()})},update:function(b){"play"===b?a.pausePlay.removeClass(e+"pause").addClass(e+
+ "play").text(c.playText):a.pausePlay.removeClass(e+"play").addClass(e+"pause").text(c.pauseText)}},touch:function(){function b(b){j=l?d-b.touches[0].pageY:d-b.touches[0].pageX;p=l?Math.abs(j)<Math.abs(b.touches[0].pageX-e):Math.abs(j)<Math.abs(b.touches[0].pageY-e);if(!p||500<Number(new Date)-k)b.preventDefault(),!r&&a.transitions&&(c.animationLoop||(j/=0===a.currentSlide&&0>j||a.currentSlide===a.last&&0<j?Math.abs(j)/q+2:1),a.setProps(f+j,"setTouch"))}function g(){i.removeEventListener("touchmove",
+ b,!1);if(a.animatingTo===a.currentSlide&&!p&&null!==j){var h=m?-j:j,l=0<h?a.getTarget("next"):a.getTarget("prev");a.canAdvance(l)&&(550>Number(new Date)-k&&50<Math.abs(h)||Math.abs(h)>q/2)?a.flexAnimate(l,c.pauseOnAction):r||a.flexAnimate(a.currentSlide,c.pauseOnAction,!0)}i.removeEventListener("touchend",g,!1);f=j=e=d=null}var d,e,f,q,j,k,p=!1;i.addEventListener("touchstart",function(j){a.animating?j.preventDefault():1===j.touches.length&&(a.pause(),q=l?a.h:a.w,k=Number(new Date),f=h&&m&&a.animatingTo===
+ a.last?0:h&&m?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:h&&a.currentSlide===a.last?a.limit:h?(a.itemW+c.itemMargin)*a.move*a.currentSlide:m?(a.last-a.currentSlide+a.cloneOffset)*q:(a.currentSlide+a.cloneOffset)*q,d=l?j.touches[0].pageY:j.touches[0].pageX,e=l?j.touches[0].pageX:j.touches[0].pageY,i.addEventListener("touchmove",b,!1),i.addEventListener("touchend",g,!1))},!1)},resize:function(){!a.animating&&a.is(":visible")&&(h||a.doMath(),r?f.smoothHeight():h?(a.slides.width(a.computedW),
+ a.update(a.pagingCount),a.setProps()):l?(a.viewport.height(a.h),a.setProps(a.h,"setTotal")):(c.smoothHeight&&f.smoothHeight(),a.newSlides.width(a.computedW),a.setProps(a.computedW,"setTotal")))},smoothHeight:function(b){if(!l||r){var c=r?a:a.viewport;b?c.animate({height:a.slides.eq(a.animatingTo).height()},b):c.height(a.slides.eq(a.animatingTo).height())}},sync:function(b){var g=d(c.sync).data("flexslider"),e=a.animatingTo;switch(b){case "animate":g.flexAnimate(e,c.pauseOnAction,!1,!0);break;case "play":!g.playing&&
+ !g.asNav&&g.play();break;case "pause":g.pause()}}};a.flexAnimate=function(b,g,n,i,k){s&&1===a.pagingCount&&(a.direction=a.currentItem<b?"next":"prev");if(!a.animating&&(a.canAdvance(b,k)||n)&&a.is(":visible")){if(s&&i)if(n=d(c.asNavFor).data("flexslider"),a.atEnd=0===b||b===a.count-1,n.flexAnimate(b,!0,!1,!0,k),a.direction=a.currentItem<b?"next":"prev",n.direction=a.direction,Math.ceil((b+1)/a.visible)-1!==a.currentSlide&&0!==b)a.currentItem=b,a.slides.removeClass(e+"active-slide").eq(b).addClass(e+
+ "active-slide"),b=Math.floor(b/a.visible);else return a.currentItem=b,a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide"),!1;a.animating=!0;a.animatingTo=b;c.before(a);g&&a.pause();a.syncExists&&!k&&f.sync("animate");c.controlNav&&f.controlNav.active();h||a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide");a.atEnd=0===b||b===a.last;c.directionNav&&f.directionNav.update();b===a.last&&(c.end(a),c.animationLoop||a.pause());if(r)p?(a.slides.eq(a.currentSlide).css({opacity:0}),
+ a.slides.eq(b).css({opacity:1}),a.animating=!1,a.currentSlide=a.animatingTo):(a.slides.eq(a.currentSlide).fadeOut(c.animationSpeed,c.easing),a.slides.eq(b).fadeIn(c.animationSpeed,c.easing,a.wrapup));else{var q=l?a.slides.filter(":first").height():a.computedW;h?(b=c.itemWidth>a.w?2*c.itemMargin:c.itemMargin,b=(a.itemW+b)*a.move*a.animatingTo,b=b>a.limit&&1!==a.visible?a.limit:b):b=0===a.currentSlide&&b===a.count-1&&c.animationLoop&&"next"!==a.direction?m?(a.count+a.cloneOffset)*q:0:a.currentSlide===
+ a.last&&0===b&&c.animationLoop&&"prev"!==a.direction?m?0:(a.count+1)*q:m?(a.count-1-b+a.cloneOffset)*q:(b+a.cloneOffset)*q;a.setProps(b,"",c.animationSpeed);if(a.transitions){if(!c.animationLoop||!a.atEnd)a.animating=!1,a.currentSlide=a.animatingTo;a.container.unbind("webkitTransitionEnd transitionend");a.container.bind("webkitTransitionEnd transitionend",function(){a.wrapup(q)})}else a.container.animate(a.args,c.animationSpeed,c.easing,function(){a.wrapup(q)})}c.smoothHeight&&f.smoothHeight(c.animationSpeed)}};
+ a.wrapup=function(b){!r&&!h&&(0===a.currentSlide&&a.animatingTo===a.last&&c.animationLoop?a.setProps(b,"jumpEnd"):a.currentSlide===a.last&&(0===a.animatingTo&&c.animationLoop)&&a.setProps(b,"jumpStart"));a.animating=!1;a.currentSlide=a.animatingTo;c.after(a)};a.animateSlides=function(){a.animating||a.flexAnimate(a.getTarget("next"))};a.pause=function(){clearInterval(a.animatedSlides);a.playing=!1;c.pausePlay&&f.pausePlay.update("play");a.syncExists&&f.sync("pause")};a.play=function(){a.animatedSlides=
+ setInterval(a.animateSlides,c.slideshowSpeed);a.playing=!0;c.pausePlay&&f.pausePlay.update("pause");a.syncExists&&f.sync("play")};a.canAdvance=function(b,g){var d=s?a.pagingCount-1:a.last;return g?!0:s&&a.currentItem===a.count-1&&0===b&&"prev"===a.direction?!0:s&&0===a.currentItem&&b===a.pagingCount-1&&"next"!==a.direction?!1:b===a.currentSlide&&!s?!1:c.animationLoop?!0:a.atEnd&&0===a.currentSlide&&b===d&&"next"!==a.direction?!1:a.atEnd&&a.currentSlide===d&&0===b&&"next"===a.direction?!1:!0};a.getTarget=
+ function(b){a.direction=b;return"next"===b?a.currentSlide===a.last?0:a.currentSlide+1:0===a.currentSlide?a.last:a.currentSlide-1};a.setProps=function(b,g,d){var e,f=b?b:(a.itemW+c.itemMargin)*a.move*a.animatingTo;e=-1*function(){if(h)return"setTouch"===g?b:m&&a.animatingTo===a.last?0:m?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:a.animatingTo===a.last?a.limit:f;switch(g){case "setTotal":return m?(a.count-1-a.currentSlide+a.cloneOffset)*b:(a.currentSlide+a.cloneOffset)*b;case "setTouch":return b;
+ case "jumpEnd":return m?b:a.count*b;case "jumpStart":return m?a.count*b:b;default:return b}}()+"px";a.transitions&&(e=l?"translate3d(0,"+e+",0)":"translate3d("+e+",0,0)",d=void 0!==d?d/1E3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",d));a.args[a.prop]=e;(a.transitions||void 0===d)&&a.container.css(a.args)};a.setup=function(b){if(r)a.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===b&&(p?a.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+
+ c.animationSpeed/1E3+"s ease"}).eq(a.currentSlide).css({opacity:1}):a.slides.eq(a.currentSlide).fadeIn(c.animationSpeed,c.easing)),c.smoothHeight&&f.smoothHeight();else{var g,n;"init"===b&&(a.viewport=d('<div class="'+e+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(a).append(a.container),a.cloneCount=0,a.cloneOffset=0,m&&(n=d.makeArray(a.slides).reverse(),a.slides=d(n),a.container.empty().append(a.slides)));c.animationLoop&&!h&&(a.cloneCount=2,a.cloneOffset=1,"init"!==
+ b&&a.container.find(".clone").remove(),a.container.append(a.slides.first().clone().addClass("clone")).prepend(a.slides.last().clone().addClass("clone")));a.newSlides=d(c.selector,a);g=m?a.count-1-a.currentSlide+a.cloneOffset:a.currentSlide+a.cloneOffset;l&&!h?(a.container.height(200*(a.count+a.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){a.newSlides.css({display:"block"});a.doMath();a.viewport.height(a.h);a.setProps(g*a.h,"init")},"init"===b?100:0)):(a.container.width(200*
+ (a.count+a.cloneCount)+"%"),a.setProps(g*a.computedW,"init"),setTimeout(function(){a.doMath();a.newSlides.css({width:a.computedW,"float":"left",display:"block"});c.smoothHeight&&f.smoothHeight()},"init"===b?100:0))}h||a.slides.removeClass(e+"active-slide").eq(a.currentSlide).addClass(e+"active-slide")};a.doMath=function(){var b=a.slides.first(),d=c.itemMargin,e=c.minItems,f=c.maxItems;a.w=a.width();a.h=b.height();a.boxPadding=b.outerWidth()-b.width();h?(a.itemT=c.itemWidth+d,a.minW=e?e*a.itemT:a.w,
+ a.maxW=f?f*a.itemT:a.w,a.itemW=a.minW>a.w?(a.w-d*e)/e:a.maxW<a.w?(a.w-d*f)/f:c.itemWidth>a.w?a.w:c.itemWidth,a.visible=Math.floor(a.w/(a.itemW+d)),a.move=0<c.move&&c.move<a.visible?c.move:a.visible,a.pagingCount=Math.ceil((a.count-a.visible)/a.move+1),a.last=a.pagingCount-1,a.limit=1===a.pagingCount?0:c.itemWidth>a.w?(a.itemW+2*d)*a.count-a.w-d:(a.itemW+d)*a.count-a.w-d):(a.itemW=a.w,a.pagingCount=a.count,a.last=a.count-1);a.computedW=a.itemW-a.boxPadding};a.update=function(b,d){a.doMath();h||(b<
+ a.currentSlide?a.currentSlide+=1:b<=a.currentSlide&&0!==b&&(a.currentSlide-=1),a.animatingTo=a.currentSlide);if(c.controlNav&&!a.manualControls)if("add"===d&&!h||a.pagingCount>a.controlNav.length)f.controlNav.update("add");else if("remove"===d&&!h||a.pagingCount<a.controlNav.length)h&&a.currentSlide>a.last&&(a.currentSlide-=1,a.animatingTo-=1),f.controlNav.update("remove",a.last);c.directionNav&&f.directionNav.update()};a.addSlide=function(b,e){var f=d(b);a.count+=1;a.last=a.count-1;l&&m?void 0!==
+ e?a.slides.eq(a.count-e).after(f):a.container.prepend(f):void 0!==e?a.slides.eq(e).before(f):a.container.append(f);a.update(e,"add");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.added(a)};a.removeSlide=function(b){var e=isNaN(b)?a.slides.index(d(b)):b;a.count-=1;a.last=a.count-1;isNaN(b)?d(b,a.slides).remove():l&&m?a.slides.eq(a.last).remove():a.slides.eq(b).remove();a.doMath();a.update(e,"remove");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.removed(a)};f.init()};d.flexslider.defaults=
+ {namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7E3,animationSpeed:600,initDelay:0,randomize:!1,pauseOnAction:!0,pauseOnHover:!1,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",
+ itemWidth:0,itemMargin:0,minItems:0,maxItems:0,move:0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};d.fn.flexslider=function(i){void 0===i&&(i={});if("object"===typeof i)return this.each(function(){var a=d(this),c=a.find(i.selector?i.selector:".slides > li");1===c.length?(c.fadeIn(400),i.start&&i.start(a)):void 0===a.data("flexslider")&&new d.flexslider(this,i)});var k=d(this).data("flexslider");switch(i){case "play":k.play();break;
+ case "pause":k.pause();break;case "next":k.flexAnimate(k.getTarget("next"),!0);break;case "prev":case "previous":k.flexAnimate(k.getTarget("prev"),!0);break;default:"number"===typeof i&&k.flexAnimate(i,!0)}}})(jQuery);
View
227 languages/default.po
@@ -0,0 +1,227 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Captain Slider\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-07 17:07+1000\n"
+"PO-Revision-Date: 2012-11-07 17:07+1000\n"
+"Last-Translator: \n"
+"Language-Team: Captain Theme <bryce@captaintheme.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-SearchPath-0: ..\n"
+
+#: ../captain-slider.php:165 ../includes/admin/settings.php:126
+msgid "Settings"
+msgstr ""
+
+#: ../includes/admin/meta-box.php:163 ../includes/admin/ui.php:78
+msgid "Slide Image"
+msgstr ""
+
+#: ../includes/admin/post-types.php:9
+msgid "Add New Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:10 ../includes/admin/post-types.php:27
+msgid "Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:11
+msgid "Edit Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:12
+msgid "New Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:13
+msgid "View Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:14
+msgid "Search Slides"
+msgstr ""
+
+#: ../includes/admin/post-types.php:15
+msgid "No Slides Found"
+msgstr ""
+
+#: ../includes/admin/post-types.php:16
+msgid "No Slides Found In Trash"
+msgstr ""
+
+#: ../includes/admin/post-types.php:17
+msgid "Parent Slide"
+msgstr ""
+
+#: ../includes/admin/post-types.php:18
+msgid "All Slides"
+msgstr ""
+
+#: ../includes/admin/settings.php:77
+msgid ""
+"If you love Captain Slider, any donation would be appreciated! It helps to "
+"continue the development and support of the plugin."
+msgstr ""
+
+#: ../includes/admin/settings.php:78
+#, php-format
+msgid ""
+"%sBut seriously, I just want to drink beer and coffee for free, so help a "
+"developer out.%sLove, Captain Theme (Bryce)%s"
+msgstr ""
+
+#: ../includes/admin/settings.php:90
+#, php-format
+msgid ""
+"I love writing documentation, so I wrote a lot of it for you: %sVisit "
+"Captain Slider Documentation%s."
+msgstr ""
+
+#: ../includes/admin/settings.php:134
+msgid "Width (px)"
+msgstr ""
+
+#: ../includes/admin/settings.php:143
+msgid "Height (px)"
+msgstr ""
+
+#: ../includes/admin/settings.php:161
+msgid "Slide Effect / Animation"
+msgstr ""
+
+#: ../includes/admin/settings.php:179
+msgid "Hide Bullets"
+msgstr ""
+
+#: ../includes/admin/settings.php:184
+msgid "Check the box to hide the slide bullets."
+msgstr ""
+
+#: ../includes/admin/settings.php:191
+msgid "Hide Navigation Arrows"
+msgstr ""
+
+#: ../includes/admin/settings.php:196
+msgid "Check the box to hide the navigation arrows."
+msgstr ""
+
+#: ../includes/admin/settings.php:205
+msgid "Slide Length (ms)"
+msgstr ""
+
+#: ../includes/admin/settings.php:214
+msgid "Animation Length (ms)"
+msgstr ""
+
+#: ../includes/admin/settings.php:223
+msgid "No Automatic Start"
+msgstr ""
+
+#: ../includes/admin/settings.php:228
+msgid "If the box is checked the slider will not automatically start/play."
+msgstr ""
+
+#: ../includes/admin/settings.php:235
+msgid "Hide Donation Link"
+msgstr ""
+
+#: ../includes/admin/settings.php:240
+msgid ""
+"Tick this box to hide the donation link above. ANY donations are appreciated!"
+msgstr ""
+
+#: ../includes/admin/settings.php:268
+msgid "You can use the following settings to configure the Captain Slider."
+msgstr ""
+
+#: ../includes/admin/settings.php:294 ../includes/admin/settings.php:312
+msgid "If left at 0, the original image size will be used."
+msgstr ""
+
+#: ../includes/admin/settings.php:319
+msgid ""
+"If you change the width/height above, you will need to regenerate the slider "
+"images."
+msgstr ""
+
+#: ../includes/admin/settings.php:321
+msgid ""
+"Either <strong>Install the <a href=\"http://a.bryce.se/z1n\">Regenate "
+"Thumbnails</a> Plugin</strong> or reupload your slides."
+msgstr ""
+
+#: ../includes/admin/settings.php:330
+msgid "Fade"
+msgstr ""
+
+#: ../includes/admin/settings.php:331
+msgid "Slide Horizontal"
+msgstr ""
+
+#: ../includes/admin/settings.php:332
+msgid "Slide Vertical"
+msgstr ""
+
+#: ../includes/admin/settings.php:341
+msgid ""
+"If you select Slide Vertical, your slides must all share the same height or "
+"they will display strangely."
+msgstr ""
+
+#: ../includes/admin/settings.php:381
+msgid "Length each slide will play for in milliseconds. Default is 6000."
+msgstr ""
+
+#: ../includes/admin/settings.php:400
+msgid ""
+"Length the slide animation/effect will go for in milliseconds. Default is "
+"600."
+msgstr ""
+
+#: ../includes/admin/taxonomy.php:12
+msgid "Add New Slider"
+msgstr ""
+
+#: ../includes/admin/taxonomy.php:13
+msgid "Edit Slider"
+msgstr ""
+
+#: ../includes/admin/taxonomy.php:14
+msgid "New Slider"
+msgstr ""
+
+#: ../includes/admin/taxonomy.php:15
+msgid "View Slider"
+msgstr ""
+
+#: ../includes/admin/taxonomy.php:16
+msgid "Search Sliders"
<