Server IP : 66.29.132.124 / Your IP : 3.140.198.3 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/misswavenigeria.com/wp-content/plugins/ombre-features/cpt/ |
Upload File : |
<?php // Register custom post type function register_ombremodels_posttype() { $labels = array( 'name' => esc_attr__( 'Models', 'ombre' ), 'singular_name' => esc_attr__( 'Model', 'ombre' ), 'add_new' => esc_attr__( 'Add new model', 'ombre' ), 'add_new_item' => esc_attr__( 'Add new model', 'ombre' ), 'edit_item' => esc_attr__( 'Edit model', 'ombre' ), 'new_item' => esc_attr__( 'New model', 'ombre' ), 'view_item' => esc_attr__( 'View model', 'ombre' ), 'search_items' => esc_attr__( 'Search models', 'ombre' ), 'not_found' => esc_attr__( 'No model found', 'ombre' ), 'not_found_in_trash'=> esc_attr__( 'No model found in trash', 'ombre' ), 'parent_item_colon' => esc_attr__( 'Parent models:', 'ombre' ), 'menu_name' => esc_attr__( 'Models', 'ombre' ) ); $supports = array('title','thumbnail','editor'); $post_type_args = array( 'labels' => $labels, 'singular_label' => esc_attr__('model', 'ombre'), 'public' => true, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_nav_menus' => true, 'publicly_queryable'=> true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => false, 'rewrite' => array( 'slug' => 'o_models', 'with_front' => false ), 'supports' => $supports, 'menu_position' => 99, 'menu_icon' => 'dashicons-id-alt' ); register_post_type('ombremodels',$post_type_args); } add_action('init', 'register_ombremodels_posttype'); // Register taxonomy function ombremodels_taxonomy() { register_taxonomy( 'ombremodelcats', 'ombremodels', array( 'labels' => array( 'name' => esc_attr__( 'Model Categories', 'ombre' ), 'add_new_item' => esc_attr__( 'Add new category', 'ombre' ), 'new_item_name' => esc_attr__( 'New category', 'ombre' ) ), 'show_ui' => true, 'show_tagcloud' => false, 'show_admin_column' => true, 'hierarchical' => true, 'rewrite' => array( 'slug' => 'o_model_categories', 'with_front' => false ) ) ); } add_action( 'init', 'ombremodels_taxonomy', 0 ); /*--------------------------------------------------- Add model thumbnail to the admin list ----------------------------------------------------*/ add_filter('manage_edit-ombremodels_columns', 'ombremodels_id', 5); add_action('manage_posts_custom_column', 'ombremodels_custom_id', 5, 2); function ombremodels_id($defaults){ $defaults['ombremodels_thumb'] = ''; return $defaults; } function ombremodels_custom_id($column_name, $post_id){ global $post; if($column_name === 'ombremodels_thumb'){ if ( has_post_thumbnail() ) { $thumb_id = get_post_thumbnail_id(); $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true); $thumb_url = $thumb_url_array[0]; echo '<div class="thumbhover"><img src="' . esc_url($thumb_url) . '" alt="" /></div>'; } } } /*--------------------------------------------------- Add id column to the taxonomy list ----------------------------------------------------*/ add_action( "manage_edit-ombremodelcats_columns", 'ombremodelcats_add_col' ); add_filter( "manage_ombremodelcats_custom_column", 'ombremodelcats_show_id', 10, 3 ); function ombremodelcats_add_col( $columns ) { return $columns + array ( 'ombremodelcatsid' => __('ID', 'ombre') ); } function ombremodelcats_show_id( $ver, $name, $id ) { $term = get_term( $id, 'ombremodelcats' ); $term_id = $term->term_id; $taxonomy = $term->name; return 'ombremodelcatsid' === $name ? $term_id : $ver; } // Custom taxonomy field (image url) add_action( 'ombremodelcats_add_form_fields', 'ombremodelcats_taxonomy_addcustom_fields', 10, 2 ); add_action( 'ombremodelcats_edit_form_fields', 'ombremodelcats_taxonomy_editcustom_fields', 10, 2 ); // Edit category screen function ombremodelcats_taxonomy_editcustom_fields($tag) { if ( ! did_action( 'wp_enqueue_media' ) ){ wp_enqueue_media(); } $t_id = $tag->term_id; $term_meta = get_option( "ombremodelcats_modelcatimage_$t_id" ); ?> <tr class="form-field"> <th scope="row"> <label for="modelcatimage_id"><?php esc_attr_e('Header Image (Optional)', 'ombre'); ?></label> </th> <td> <input type="text" name="modelcatimage" id="modelcatimage" value="<?php if (!empty($term_meta)) { esc_attr_e($term_meta); } ?>" /> <br/><input id="modelcatimage_image_button" class="button" type="button" value="<?php esc_attr_e( 'Upload Image', 'ombre') ?>" /> <script type="text/javascript">jQuery(document).ready(function(e){var t;e("#modelcatimage_image_button").click(function(a){return a.preventDefault(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1}),t.on("select",function(){attachment=t.state().get("selection").first().toJSON(),e("#modelcatimage").val(attachment.url)}),void t.open())})});</script> </td> </tr> <?php } // Add category screen function ombremodelcats_taxonomy_addcustom_fields($tag) { if ( ! did_action( 'wp_enqueue_media' ) ){ wp_enqueue_media(); } $t_id = isset($tag->term_id); $term_meta = get_option( "ombremodelcats_modelcatimage_$t_id" ); ?> <div class="form-field" style="margin-bottom:30px;"> <label for="modelcatimage_id"><?php esc_attr_e('Header Image (Optional)', 'ombre'); ?></label> <input type="text" name="modelcatimage" id="modelcatimage" value="<?php if (!empty($term_meta)) { esc_attr_e($term_meta); } ?>" /> <p><?php esc_attr_e( 'This image will be displayed as a header image on category page.', 'ombre') ?></p> <input id="modelcatimage_image_button" class="button" type="button" value="<?php esc_attr_e( 'Upload Image', 'ombre') ?>" /> </div> <script type="text/javascript">jQuery(document).ready(function(e){var t;e("#modelcatimage_image_button").click(function(a){return a.preventDefault(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({title:"Choose Image",button:{text:"Choose Image"},multiple:!1}),t.on("select",function(){attachment=t.state().get("selection").first().toJSON(),e("#modelcatimage").val(attachment.url)}),void t.open())})});</script> <?php } // Save Custom Field Of Category Form add_action( 'created_ombremodelcats', 'ombremodelcats_form_custom_field_save', 10, 2 ); add_action( 'edited_ombremodelcats', 'ombremodelcats_form_custom_field_save', 10, 2 ); function ombremodelcats_form_custom_field_save( $term_id, $tt_id ) { if ( isset( $_POST['modelcatimage'] ) ) { $option_name = 'ombremodelcats_modelcatimage_' . $term_id; update_option( $option_name, $_POST['modelcatimage'] ); } } // Gallery Excerpt function ombre_modelexcerpt( $meta_boxes ) { $prefix = 'ombre'; // Prefix for all fields $meta_boxes['ombre_modelexcerpt'] = array( 'id' => 'ombre_modelexcerpt', 'title' => esc_attr__( 'Model Info', 'ombre'), 'object_types' => array('ombremodels'), // post type 'context' => 'normal', // normal or side 'priority' => 'default', // default or high 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => esc_attr__( 'Hide Text', 'ombre'), 'desc' => esc_attr__( 'To hide title and description, check this box.', 'ombre'), 'id' => $prefix . 'hidemodeltext', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Info', 'ombre'), 'id' => $prefix . 'modelexcerpt', 'type' => 'text' ), ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modelexcerpt' ); // Slider function ombre_modelphotos( $meta_boxes ) { $prefix = 'ombre'; $meta_boxes['ombre_modelimg'] = array( 'id' => 'ombre_modelimg', 'title' => esc_attr__( 'Slider', 'ombre'), 'object_types' => array('ombremodels'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true, 'fields' => array( array( 'name' => esc_attr__( 'Activate Autoplay', 'ombre'), 'desc' => esc_attr__( 'To activate autoplay, check this box.', 'ombre'), 'id' => $prefix . 'm_activateauto', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Activate Colorbox', 'ombre'), 'desc' => esc_attr__( 'To activate colorbox, check this box.', 'ombre'), 'id' => $prefix . 'm_activatecolorbox', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Autoplay duration:', 'ombre'), 'id' => $prefix . 'm_autoplaypause', 'desc' => esc_attr__( 'The time (in seconds) between each auto transition', 'ombre'), 'type' => 'select', 'options' => array( '4' => esc_attr__( '4 Seconds', 'ombre' ), '2' => esc_attr__( '2 Seconds', 'ombre' ), '3' => esc_attr__( '3 Seconds', 'ombre' ), '5' => esc_attr__( '5 Seconds', 'ombre' ), '6' => esc_attr__( '6 Seconds', 'ombre' ), '7' => esc_attr__( '7 Seconds', 'ombre' ), '8' => esc_attr__( '8 Seconds', 'ombre' ), '9' => esc_attr__( '9 Seconds', 'ombre' ), '10' => esc_attr__( '10 Seconds', 'ombre' ), '11' => esc_attr__( '11 Seconds', 'ombre' ), '12' => esc_attr__( '12 Seconds', 'ombre' ), '13' => esc_attr__( '13 Seconds', 'ombre' ), '14' => esc_attr__( '14 Seconds', 'ombre' ), '15' => esc_attr__( '15 Seconds', 'ombre' ), ), ), array( 'id' => $prefix . 'modelimages', 'name' => esc_attr__( 'Select Images:', 'ombre'), 'desc' => esc_attr__( 'You can make a multiselection with CTRL + click', 'ombre'), 'type' => 'file_list', 'preview_size' => array( 100, 100 ) ), ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modelphotos' ); // Education - Qualification function ombre_modeleq( $meta_boxes ) { $prefix = 'ombre'; $meta_boxes['ombre_modeleq'] = array( 'id' => 'ombre_modeleq', 'title' => esc_attr__( 'Education - Qualification', 'ombre'), 'object_types' => array('ombremodels'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true, 'fields' => array( array( 'desc' => esc_attr__( 'To create a list, check this box.', 'ombre'), 'id' => $prefix . 'educationcheck', 'type' => 'checkbox' ), array( 'id' => $prefix . 'education', 'type' => 'group', 'options' => array( 'group_title' => esc_attr__( 'Row {#}', 'ombre' ), 'add_button' => esc_attr__( 'Add Another Row', 'ombre' ), 'remove_button' => esc_attr__( 'Remove Row', 'ombre' ), 'sortable' => true, 'closed' => true ), 'fields' => array( array( 'name' => esc_attr__( 'Title:', 'ombre'), 'id' => $prefix . 'eq_title', 'type' => 'text' ), array( 'name' => esc_attr__( 'Sub Title:', 'ombre'), 'id' => $prefix . 'eq_subtitle', 'type' => 'text' ), array( 'name' => esc_attr__( 'Info:', 'ombre'), 'id' => $prefix . 'eq_info', 'type' => 'textarea_small' ), ), ), ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modeleq' ); // Custom cmb2 taxonomy field function ombre_cmb2_get_term_options( $taxonomy = 'ombremodelcats', $args = array() ) { $args['taxonomy'] = $taxonomy; $args = wp_parse_args( $args, array( 'taxonomy' => 'ombremodelcats' ) ); $taxonomy = $args['taxonomy']; $terms = (array) get_terms( $taxonomy, $args ); // Initate an empty array $term_options = array(); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $term_options[ $term->term_id ] = $term->name; } } return $term_options; } // Models Carousel function ombre_modelcarousel( $meta_boxes ) { $prefix = 'ombre'; $meta_boxes['ombre_model_carousel'] = array( 'id' => 'ombre_model_carousel', 'title' => esc_attr__( 'Models Carousel', 'ombre'), 'object_types' => array('ombremodels'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true, 'fields' => array( array( 'name' => esc_attr__( 'Activate Carousel:', 'ombre'), 'desc' => esc_attr__( 'To activate models carousel, check this box.', 'ombre'), 'id' => $prefix . 'relatedmodels', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Title:', 'ombre'), 'id' => $prefix . 'relatedmodelstitle', 'type' => 'text' ), array( 'name' => esc_attr__( 'Activate Autoplay', 'ombre'), 'desc' => esc_attr__( 'To activate autoplay, check this box.', 'ombre'), 'id' => $prefix . 'relatedmodelsauto', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Autoplay duration:', 'ombre'), 'id' => $prefix . 'relatedmodelspause', 'desc' => esc_attr__( 'The time (in seconds) between each auto transition', 'ombre'), 'type' => 'select', 'options' => array( '4' => esc_attr__( '4 Seconds', 'ombre' ), '2' => esc_attr__( '2 Seconds', 'ombre' ), '3' => esc_attr__( '3 Seconds', 'ombre' ), '5' => esc_attr__( '5 Seconds', 'ombre' ), '6' => esc_attr__( '6 Seconds', 'ombre' ), '7' => esc_attr__( '7 Seconds', 'ombre' ), '8' => esc_attr__( '8 Seconds', 'ombre' ), '9' => esc_attr__( '9 Seconds', 'ombre' ), '10' => esc_attr__( '10 Seconds', 'ombre' ), '11' => esc_attr__( '11 Seconds', 'ombre' ), '12' => esc_attr__( '12 Seconds', 'ombre' ), '13' => esc_attr__( '13 Seconds', 'ombre' ), '14' => esc_attr__( '14 Seconds', 'ombre' ), '15' => esc_attr__( '15 Seconds', 'ombre' ), ), ), array( 'name' => esc_attr__( 'Number of columns:', 'ombre'), 'id' => $prefix . 'relatedmodelscolumns', 'type' => 'select', 'options' => array( '3' => esc_attr__( '3 Columns', 'ombre' ), '4' => esc_attr__( '4 Columns', 'ombre' ), '2' => esc_attr__( '2 Columns', 'ombre' ) ), ), array( 'name' => esc_attr__( 'Maximum number of items:', 'ombre'), 'id' => $prefix . 'relatedmodelsmax', 'type' => 'text', 'default' => '99' ), array( 'name' => esc_attr__( 'Category:', 'ombre'), 'id' => $prefix . 'relatedmodelscatid', 'type' => 'multicheck', 'options' => ombre_cmb2_get_term_options() ) ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modelcarousel' ); // Layout function ombre_modellayout( $meta_boxes ) { $prefix = 'ombre'; $meta_boxes['ombre_modellayout'] = array( 'id' => 'ombre_modellayout', 'title' => esc_attr__( 'Layout', 'ombre'), 'object_types' => array('ombremodels'), 'context' => 'normal', 'priority' => 'default', 'show_names' => false, 'fields' => array( array( 'name' => esc_attr__( 'Layout Style:', 'ombre'), 'id' => $prefix . 'modellayout', 'type' => 'select', 'options' => array( 'fullwidth' => esc_attr__( 'Full Width', 'ombre' ), 'right' => esc_attr__( 'Sidebar - Right', 'ombre' ), 'left' => esc_attr__( 'Sidebar - Left', 'ombre' ) ), ) ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modellayout' ); // Sidebar function ombre_modelsidebar( $meta_boxes ) { $prefix = 'ombre'; $meta_boxes['ombre_modelsidebar'] = array( 'id' => 'ombre_modelsidebar', 'title' => esc_attr__( 'Sidebar', 'ombre'), 'object_types' => array('ombremodels'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true, 'fields' => array( array( 'name' => esc_attr__( 'Slider', 'ombre'), 'desc' => esc_attr__( 'If you check this box, slider will be displayed at the top of the sidebar.', 'ombre'), 'id' => $prefix . 'sidebarslider', 'type' => 'checkbox' ), array( 'name' => esc_attr__( 'Image', 'ombre'), 'id' => $prefix . 'sidebarimg', 'type' => 'file', // Optional: 'options' => array( 'url' => false, 'add_upload_file_text' => esc_attr__( 'Upload Image', 'ombre') ), ), array( 'name' => esc_attr__( 'Info:', 'ombre'), 'id' => $prefix . 'sidebarinfo', 'type' => 'textarea_small' ), array( 'name' => esc_attr__( 'Add a List', 'ombre'), 'desc' => esc_attr__( 'To create a list, check this box.', 'ombre'), 'id' => $prefix . 'sidebarlistcheck', 'type' => 'checkbox' ), array( 'id' => $prefix . 'sidebarlist', 'type' => 'group', 'options' => array( 'group_title' => esc_attr__( 'Row {#}', 'ombre' ), 'add_button' => esc_attr__( 'Add Another Row', 'ombre' ), 'remove_button' => esc_attr__( 'Remove Row', 'ombre' ), 'sortable' => true, 'closed' => true ), 'fields' => array( array( 'name' => esc_attr__( 'Left:', 'ombre'), 'id' => $prefix . 'sidebarlistleft', 'type' => 'text' ), array( 'name' => esc_attr__( 'Right:', 'ombre'), 'id' => $prefix . 'sidebarlistright', 'type' => 'text' ), ), ), array( 'name' => esc_attr__( 'Add a Social Icon List', 'ombre'), 'desc' => esc_attr__( 'To add social icons, check this box.', 'ombre'), 'id' => $prefix . 'sidebariconscheck', 'type' => 'checkbox' ), array( 'id' => $prefix . 'sidebaricons', 'type' => 'group', 'options' => array( 'group_title' => esc_attr__( 'Icon {#}', 'ombre' ), 'add_button' => esc_attr__( 'Add Another Icon', 'ombre' ), 'remove_button' => esc_attr__( 'Remove Icon', 'ombre' ), 'sortable' => true, 'closed' => true ), 'fields' => array( array( 'name' => esc_attr__( 'Title:', 'ombre'), 'id' => $prefix . 'sidebaricontitle', 'type' => 'text' ), array( 'name' => esc_attr__( 'Select Icon:', 'ombre'), 'id' => $prefix . 'sidebariconimg', 'desc' => esc_attr__( 'Select an icon or add a Font Awesome icon manually', 'ombre'), 'type' => 'select', 'options' => array( 'facebook-f' => esc_attr__( 'Facebook', 'ombre' ), 'twitter' => esc_attr__( 'Twitter', 'ombre' ), 'google-plus' => esc_attr__( 'Google Plus', 'ombre' ), 'linkedin' => esc_attr__( 'Linkedin', 'ombre' ), 'instagram' => esc_attr__( 'Instagram', 'ombre' ), 'vimeo' => esc_attr__( 'Vimeo', 'ombre' ), 'youtube' => esc_attr__( 'You Tube', 'ombre' ), 'behance' => esc_attr__( 'Behance', 'ombre' ), 'codepen' => esc_attr__( 'Codepen', 'ombre' ), 'apple' => esc_attr__( 'Apple', 'ombre' ), 'dribbble' => esc_attr__( 'Dribbble', 'ombre' ), 'flickr' => esc_attr__( 'Flickr', 'ombre' ), 'github' => esc_attr__( 'Github', 'ombre' ), 'pinterest' => esc_attr__( 'Pinterest', 'ombre' ), 'soundcloud' => esc_attr__( 'Soundcloud', 'ombre' ), 'vk' => esc_attr__( 'VK', 'ombre' ), ), ), array( 'name' => esc_attr__( 'Custom icon:', 'ombre'), 'id' => $prefix . 'sidebariconcustom', 'desc' => '<a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">' . esc_attr__( 'Click to view Font Awesome icon list', 'ombre') . '</a>', 'type' => 'text' ), array( 'name' => esc_attr__( 'Link:', 'ombre'), 'desc' => esc_attr__( 'Example; http://www.themeforest.net', 'ombre'), 'id' => $prefix . 'sidebariconlink', 'type' => 'text' ), ), ), ), ); return $meta_boxes; } add_filter( 'cmb2_meta_boxes', 'ombre_modelsidebar' ); ?>