Server IP : 66.29.132.124 / Your IP : 18.226.52.26 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/ |
Upload File : |
<?php /* --------------------------------------------------------- Header Image ----------------------------------------------------------- */ function ombre_featured_image() { $screens = array( 'post', 'page', 'ombremodels' ); foreach ( $screens as $screen ) { add_meta_box( 'ombre_featured_image_id', esc_attr__( 'Header Image (Optional)', 'ombre' ), 'ombre_featured_image_box', $screen, 'side', 'low' ); } } add_action( 'add_meta_boxes', 'ombre_featured_image' ); function ombre_featured_image_box( $post ) { wp_nonce_field( 'ombre_featured_image_box', 'ombre_featured_image_box_nonce' ); $value = get_post_meta( $post->ID, 'ombre_featured_image_key', true ); ?> <img id="ombre_featured_thumbnail" src="<?php echo esc_attr( $value ); ?>" alt="" style="<?php if(empty($value)) { echo esc_attr('display:none'); } ?>" /> <input type="hidden" id="ombre_featured_image" name="ombre_featured_image" value="<?php echo esc_attr( $value ); ?>" /> <p class="ombre_featured_image_text"><input id="ombre_featured_image_button" class="button" type="button" value="<?php echo esc_attr__( 'Upload Image', 'ombre') ?>" /></p> <a id="ombre_remove_featured" href="#" style="<?php if(empty($value)) { echo esc_attr('display:none'); } ?>"><?php echo esc_attr__( 'Remove header image', 'ombre') ?></a> <script type="text/javascript"> jQuery(document).ready(function($){ var custom_uploader; $("#ombre_featured_image_button").click(function(e) { e.preventDefault(); if (custom_uploader) { custom_uploader.open(); return; } custom_uploader = wp.media.frames.file_frame = wp.media({ title: "<?php echo esc_attr__( 'Choose Image', 'ombre') ?>", button: { text: "<?php echo esc_attr__( 'Choose Image', 'ombre') ?>" }, multiple: false }); custom_uploader.on("select", function() { attachment = custom_uploader.state().get("selection").first().toJSON(); $("#ombre_featured_image").val(attachment.url); $("#ombre_featured_thumbnail").attr('src', attachment.url); $("#ombre_featured_thumbnail").css('display', 'block'); $("#ombre_remove_featured").css('display', 'block'); }); custom_uploader.open(); }); $("#ombre_remove_featured").click(function(e) { e.preventDefault(); $("#ombre_featured_thumbnail").css('display', 'none'); $("#ombre_featured_image").val(''); $(this).css('display', 'none'); }); }); </script> <?php } function featured_image_save_postdata( $post_id ) { if ( ! isset( $_POST['ombre_featured_image_box_nonce'] ) ) return $post_id; $nonce = $_POST['ombre_featured_image_box_nonce']; if ( ! wp_verify_nonce( $nonce, 'ombre_featured_image_box' ) ) return $post_id; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) return $post_id; } else { if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id; } $mydata = sanitize_text_field( $_POST['ombre_featured_image'] ); update_post_meta( $post_id, 'ombre_featured_image_key', $mydata ); } add_action( 'save_post', 'featured_image_save_postdata' ); /* --------------------------------------------------------- Sidebar option ----------------------------------------------------------- */ function ombre_post_sidebar() { $screens = array( 'post' ); foreach ( $screens as $screen ) { add_meta_box( 'ombre_post_sidebar_id', esc_attr__( 'Sidebar', 'ombre' ), 'ombre_post_sidebar_box', $screen, 'side', 'low' ); } } add_action( 'add_meta_boxes', 'ombre_post_sidebar' ); function ombre_post_sidebar_box( $post ) { wp_nonce_field( 'ombre_post_sidebar_box', 'ombre_post_sidebar_box_nonce' ); $value = get_post_meta( $post->ID, 'ombre_post_sidebar_key', true ); ?> <div class="ombre-post-sidebar"> <input id="ombre_post_sidebar" type="checkbox" name="ombre_post_sidebar" value="true" <?php if($value == 'true'){ ?> checked="checked" <?php } ?> /> </div> <?php } function ombre_post_sidebar_save_postdata( $post_id ) { if ( ! isset( $_POST['ombre_post_sidebar_box_nonce'] ) ) return $post_id; $nonce = $_POST['ombre_post_sidebar_box_nonce']; if ( ! wp_verify_nonce( $nonce, 'ombre_post_sidebar_box' ) ) return $post_id; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id; if ( !empty($_POST['ombre_post_sidebar'])) { $mydata = sanitize_text_field( $_POST['ombre_post_sidebar'] ); update_post_meta( $post_id, 'ombre_post_sidebar_key', $mydata ); } else { delete_post_meta( $post_id, 'ombre_post_sidebar_key'); } } add_action( 'save_post', 'ombre_post_sidebar_save_postdata' ); /* --------------------------------------------------------- Subtitle ----------------------------------------------------------- */ function ombre_subtitle() { $screens = array( 'page', 'ombremodels', 'ombreslider' ); foreach ( $screens as $screen ) { add_meta_box( 'ombre_subtitle_id', esc_attr__( 'Subtitle (Optional)', 'ombre' ), 'ombre_subtitle_box', $screen, 'normal', 'high' ); } } add_action( 'add_meta_boxes', 'ombre_subtitle' ); function ombre_subtitle_box( $post ) { wp_nonce_field( 'ombre_subtitle_box', 'ombre_subtitle_box_nonce' ); $value = get_post_meta( $post->ID, 'ombre_subtitle_key', true ); ?> <div class="ombre-subtitle-container"> <input id="ombre_subtitle" type="text" name="ombre_subtitle" value="<?php if (!empty($value)) { echo stripslashes(esc_attr($value)); } ?>" /> </div> <?php } function ombre_subtitle_save_postdata( $post_id ) { if ( ! isset( $_POST['ombre_subtitle_box_nonce'] ) ) return $post_id; $nonce = $_POST['ombre_subtitle_box_nonce']; if ( ! wp_verify_nonce( $nonce, 'ombre_subtitle_box' ) ) return $post_id; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) return $post_id; } $mydata = sanitize_text_field( $_POST['ombre_subtitle'] ); update_post_meta( $post_id, 'ombre_subtitle_key', $mydata ); } add_action( 'save_post', 'ombre_subtitle_save_postdata' ); ?>