array(
'name' => __('Accarousel Items'),
'singular_name' => __('Accarousel Item'),
'add_new_item' => __('Add New Accarousel Item')
),
'show_in_menu' => true,
'menu_icon' => 'dashicons-slides',
'public' => true,
'supports' => array('thumbnail','title','editor','custom_fields'),
'has_archive' => true,
'rewrite' => array('slug' => 'accarousel_item')
)
);
}
// Taxonomy
function accarousel_taxonomy () {
register_taxonomy (
'accarousel_cat', // The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces). )
'accarousel-items', // post type name
array (
'hierarchical' => true,
'label' => 'Accarousel Category',
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array (
'slug' => 'accarousel-category', // This controls the base slug that will display before each term.
'with_front' => true // Don't display the category base before.
)
)
);
}
add_action('init', 'accarousel_taxonomy');
/*Carousel Shortcode Support */
function accarouosel_get_carousel() {
$accarouosel= '
';
$efs_query="post_type=accarousel-items&posts_per_page=-1";
query_posts($efs_query);
if (have_posts()) : while (have_posts()) : the_post();
$thumb = get_the_post_thumbnail ($post->ID, 'accarousel-thumb');
$detail_thumb = get_the_post_thumbnail ($post->ID, 'detail-thumb');
$accarouosel.='-
'.$thumb.'
'.$detail_thumb.'
';
endwhile; endif; wp_reset_query();
$accarouosel.='
';
return $accarouosel;
}
/*Add the shortcode for the slider for use in editor ***/
function get_accarouosel ($atts, $content=null){
$accarouosel = accarouosel_get_carousel();
return $accarouosel;
}
add_shortcode ('accarousel','get_accarouosel');
// Options page start
function add_accarousel_options_framwrork()
{
add_menu_page('Accarousel Options', 'Accarousel Options', 'manage_options', 'accarousel-settings','accarousel_options_framwrork', plugins_url( '/images/icon.png', __FILE__ ), 59 );
}
add_action('admin_menu', 'add_accarousel_options_framwrork');
// Default options values
$accarousel_options_framwrork = array(
'groupOf' => '5', /* Number of stands for visible group*/
'scrollSpeed' => '1000', /* Carousel Speed */
'ease' => 'swing', /* Use jQuery Easing Plug in for more easing effects */
'flyOutGap' => '3', /* Gap between expanded and other two flyouts */
'nextprev' => 'true' /* set false to disable Next/Prev Nav */
);
if ( is_admin() ) : // Load only if we are viewing an admin page
function accarousel_register_settings() {
// Register settings and call sanitation functions
register_setting( 'accarousel_p_options', 'accarousel_options_framwrork', 'accarousel_validate_options' );
}
add_action( 'admin_init', 'accarousel_register_settings' );
// Store layouts views in array
$next_prev_mode = array(
'nextprev_yes' => array(
'value' => 'true',
'label' => 'Enable Next/Prev Nav'
),
'nextprev_no' => array(
'value' => 'false',
'label' => 'Disable Next/Prev Nav'
),
);
// Function to generate options page
function accarousel_options_framwrork() {
global $accarousel_options_framwrork, $next_prev_mode;
if ( ! isset( $_REQUEST['updated'] ) )
$_REQUEST['updated'] = false; // This checks whether the form has just been submitted. ?>