array( 'name' => __('Acquaint Owl Carousel'), 'singular_name' => __('acquaint_owl_carousel'), 'add_new' => __('Add New Slide'),'add_new' => __( 'Add New Slider', AQSS_TEXT_DOMAIN ), 'add_new_item' => __( 'Add New Carouse Slider', AQSS_TEXT_DOMAIN ), 'edit_item' => __( 'Edit Carouse Slider', AQSS_TEXT_DOMAIN ), 'view_item' => __( 'View Image Slider', AQSS_TEXT_DOMAIN ), ), 'hierarchical' => false, 'supports' => array( 'title' ), 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, 'menu_icon' => 'dashicons-format-gallery', 'show_in_nav_menus' => false, 'publicly_queryable' => false, 'exclude_from_search' => true, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => false, 'capability_type' => 'post' ) ); } // Change Slider Title function wpb_change_title_text( $title ){ $screen = get_current_screen(); if ( 'owl_carousel' == $screen->post_type ) { $title = 'Enter Slider Title'; } return $title; } /* ------------------ Adds a custom Owl Carousel box ------------------ */ function carousel_meta_box_add() { add_meta_box('carouseldiv', 'Slide Settings', array($this, 'carousel_meta_box'), 'owl_carousel', 'normal', 'low'); } /* ------------------ Get Owl Carousel slider types in metabox --------------------- */ function carousel_meta_box($post) { global $post; $post_id = $post->ID; $get_slider_type = get_post_meta($post_id, 'slider_type', true); $autoplay_checked = 'checked'; $animate_checked = ''; $auto_height_checked = ''; $auto_width_checked = ''; $center_checked = ''; $events_checked = ''; $lazy_load_checked = ''; $merge_checked = ''; $mousewheel_checked = ''; $responsive_checked = ''; $right_to_left_checked = ''; $stagepadding_checked = ''; $url_hash_navigation_checked = ''; $video_checked = ''; if ($get_slider_type == 'animate') { $animate_checked = 'checked'; } if ($get_slider_type == 'auto_height') { $auto_height_checked = 'checked'; } if ($get_slider_type == 'auto_width') { $auto_width_checked = 'checked'; } if ($get_slider_type == 'center') { $center_checked = 'checked'; } if ($get_slider_type == 'events') { $events_checked = 'checked'; } if ($get_slider_type == 'lazy_load') { $lazy_load_checked = 'checked'; } if ($get_slider_type == 'merge') { $merge_checked = 'checked'; } if ($get_slider_type == 'mousewheel') { $mousewheel_checked = 'checked'; } if ($get_slider_type == 'responsive') { $responsive_checked = 'checked'; } if ($get_slider_type == 'right_to_left') { $right_to_left_checked = 'checked'; } if ($get_slider_type == 'stagepadding') { $stagepadding_checked = 'checked'; } if ($get_slider_type == 'url_hash_navigation') { $url_hash_navigation_checked = 'checked'; } if ($get_slider_type == 'video') { $video_checked = 'checked'; } /* * Start: Slider Types HTML */ $slider_type = '

'; /* * End: Slider Types HTML */ echo $slider_type; } /* ------------------ Add a custom Owl Carousel Data box ------------------ */ function carousel_images_meta_box_add() { add_meta_box('carouselimagesdiv', 'Slider', array($this, 'carousel_images_meta_box'), 'owl_carousel', 'normal', 'low'); } /* ------------------ add/edit slider data in metabox --------------------- */ function carousel_images_meta_box($post) { global $post; $post_id = $post->ID; /*---------------------------- Start: Slide js ---------------------------------*/ ?> Note: Accept Youtube and Vimeo videos only. '; for ($i=0; $i < $count_tolal_slide; $i++) { ?>
Title
Upload Image
$imagefileurl, 'type' => $imagefiletype, 'tmp_name' => $imagetempname, 'error' => $imageerror, 'size' => $imagesize ); $movefile = wp_handle_upload($uploadedfile, array('test_form' => FALSE)); if ($imagefileurl != '') { $slideimage[] = $movefile['url']; } else { $slideimage[] = sanitize_text_field($_POST['hidden_image'][$i]); } } if (isset($slider_title_post) || isset($slideimage) || isset($slider_merge_post) || isset($slider_video_post)) { $slidetitle = implode(',', $slider_title_post); $slideimage = implode(',', $slideimage); $slidemerge = implode(',', $slider_merge_post); $slidevideo = implode(',', $slider_video_post); } $slidetitles = get_post_meta($post_id, 'slide_title'); if ($slidetitles != '') { update_post_meta($post_id, 'slide_title', $slidetitle); } else { add_post_meta($post_id, 'slide_title', $slidetitle); } $slideimages = get_post_meta($post_id, 'slide_image'); if ($slideimages != '') { update_post_meta($post_id, 'slide_image', $slideimage); } else { add_post_meta($post_id, 'slide_image', $slideimage); } $slidemerges = get_post_meta($post_id, 'slide_merge'); if ($slidemerges != '') { update_post_meta($post_id, 'slide_merge', $slidemerge); } else { add_post_meta($post_id, 'slide_merge', $slidemerge); } $slidevideos = get_post_meta($post_id, 'slide_video'); if ($slidevideos != '') { update_post_meta($post_id, 'slide_video', $slidevideo); } else { add_post_meta($post_id, 'slide_video', $slidevideo); } } /*---------------------- End: Add/edit data save-------------------------*/ // Add Shortcode Columns Heading on Acquiant Owl Carousel Listing function custom_columns_heading($columns) { $column['cb'] = ''; $column['title'] = 'Title'; $column['shortcode'] = 'shortcode'; $column['date'] = 'Date'; return $column; } // Add Shortcode Columns Value on Acquiant Owl Carousel Listing function custom_columns($column, $post_id) { switch ($column) { case 'shortcode': echo '[acquaint-owl-carousel id="' . esc_attr($post_id) . '"]'; break; } } // Include Owl Carousel Css and js function acquaint_owl_carousel_style() { wp_enqueue_style('docs_theme', plugins_url('acquaint-owl-carousel') . '/assets/css/docs_theme.min.css'); wp_enqueue_style('acquaint_owl_carousel', plugins_url('acquaint-owl-carousel') . '/assets/css/acquaint_owl_carousel.min.css'); wp_enqueue_style('acquaint_owl_theme_default', plugins_url('acquaint-owl-carousel') . '/assets/css/acquaint_owl_theme_default.min.css'); wp_enqueue_script('acquaint', plugins_url('acquaint-owl-carousel') . '/assets/js/jquery.acquaint.min.js', array('jquery')); wp_enqueue_script('acquaint_owl_carousel', plugins_url('acquaint-owl-carousel') . '/assets/js/acquaint_owl_carousel.js', array('jquery')); wp_enqueue_style('animate', plugins_url('acquaint-owl-carousel') . '/assets/css/animate.css'); } /*---------------------- Start: Display slider shortcode at front -------------------------*/ function acquaint_owl_carousel($atts) { $id = $atts['id']; $slider_type = get_post_meta($id, 'slider_type', true); $slider = '
'; if ($slider_type == 'autoplay') { $slider .= autoplay($id); } if ($slider_type == 'animate') { $slider .= animate($id); } if ($slider_type == 'auto_height') { $slider .= auto_height($id); } if ($slider_type == 'auto_width') { $slider .= auto_width($id); } if ($slider_type == 'center') { $slider .= center($id); } if ($slider_type == 'events') { $slider .= events($id); } if ($slider_type == 'lazy_load') { $slider .= lazy_load($id); } if ($slider_type == 'merge') { $slider .= merge($id); } if ($slider_type == 'mousewheel') { $slider .= mousewheel($id); } if ($slider_type == 'responsive') { $slider .= responsive($id); } if ($slider_type == 'right_to_left') { $slider .= right_to_left($id); } if ($slider_type == 'stagepadding') { $slider .= stagepadding($id); } if ($slider_type == 'url_hash_navigation') { $slider .= url_hash_navigation($id); } if ($slider_type == 'video') { $slider .= video($id); } $slider .= '
'; return $slider; } /*---------------------- End: Display slider shortcode at front -------------------------*/ } // Create Acquaint_Owl_Carousel_Plugin Method $acquaint_owl_carousel = new Acquaint_Owl_Carousel_Plugin(); // Auto Play Owl Carousel function autoplay($id) { $slider = ' '; return $slider; } // Animate Owl Carousel function animate($id) { $slider = ' '; return $slider; } // Auto Height Owl Carousel function auto_height($id) { $slider = ' '; return $slider; } // Auto Width Owl Carousel function auto_width($id) { $slider = ' '; return $slider; } // Center Owl Carousel function center($id) { $slider = ' '; return $slider; } // Events Owl Carousel function events($id) { $slider = ' '; return $slider; } // Lazy Load Owl Carousel function lazy_load($id) { $slider = ' '; return $slider; } // Merge Owl Carousel function merge($id) { $slider = ' '; return $slider; } // Mousewheel Owl Carousel function mousewheel($id) { $slider = ' '; return $slider; } // Responsive Owl Carousel function responsive($id) { $slider = ' '; return $slider; } // Right to Left Owl Carousel function right_to_left($id) { $slider = ' '; return $slider; } // Stagepadding Owl Carousel function stagepadding($id) { $slider = ' '; return $slider; } // URL Hash Navigation Owl Carousel function url_hash_navigation($id) { $slider = ''; $a = 0; $al = 0; foreach ($slideimage as $image) { if ($a == $al) { $slider .= '' . $a . ''; $al += 3; } $a++; } $slider .= ''; return $slider; } // Video Owl Carousel function video($id) { $slider = ''; $slider .= ''; return $slider; } /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_acquaint_owl_carousel() { $plugin = new Acquaint_Owl_Carousel(); $plugin->run(); } run_acquaint_owl_carousel();