File manager - Edit - /home/aussies6/public_html/seafoodwarehouse.com.au/wp-content/themes/topshop/includes/inc/slider-post-meta-box.php
Back
<?php /* * * Create a Custom Meta Box only on Pages * */ function topshop_add_slider_post_meta_box() { add_meta_box( 'topshop-page-meta-box', __( 'Slide Custom Link', 'topshop' ), 'topshop_create_slider_post_meta_box', 'post', 'normal', null ); } add_action( 'add_meta_boxes', 'topshop_add_slider_post_meta_box' ); /* * * Function to create the Page meta box * */ function topshop_create_slider_post_meta_box( $object ) { wp_nonce_field( basename( __FILE__ ), 'topshop-slider-post-meta-box-nonce' ); ?> <input name="topshop-meta-box-slider-link" class="topshop-slider-link" type="text" placeholder="Eg: http://page-link.com/" value="<?php echo get_post_meta( $object->ID, 'topshop-meta-box-slider-link', true ); ?>"> <p> <?php printf( __( 'Enter the full url to the page this slide must link to. Don\'t forget the <i>http://</i>', 'topshop' ) ); ?> </p> <?php } /* * * Saving the data for the page meta box * */ function topshop_save_slider_post_meta_box( $post_id, $post, $update ) { if ( !isset( $_POST['topshop-slider-post-meta-box-nonce'] ) || !wp_verify_nonce( $_POST['topshop-slider-post-meta-box-nonce'], basename( __FILE__ ) ) ) return $post_id; if ( !current_user_can( "edit_post", $post_id ) ) return $post_id; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; $slug = 'post'; if ( $slug != $post->post_type ) return $post_id; $meta_box_slider_custom_link = ''; if ( isset( $_POST['topshop-meta-box-slider-link'] ) ) { $meta_box_slider_custom_link = $_POST['topshop-meta-box-slider-link']; } update_post_meta( $post_id, 'topshop-meta-box-slider-link', $meta_box_slider_custom_link ); } add_action( 'save_post', 'topshop_save_slider_post_meta_box', 10, 3 );
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings