php - Remove a specific function from theme parent Wordpress -
i try remove "meta_box" action parent theme function.php, don't succeed.
i tried many function, think don't doing well. here, functions tried apply:
if (!function_exists('add_meta_box')) { function add_meta_box() {add_meta_box( 'portfolio-meta-boxes', __('portfolio options','raw'), 'child_display_portfolio_meta_box', 'udt_portfolio', 'normal', 'high' ); } } function child_display_portfolio_meta_box() {...} or
add-action('after_theme_setup', 'remove_fonction_parent'); function remove_fonction_parent() { function remove_fonction_parent() { remove_meta_box('page_layout','display_portfolio_meta_box'); add_meta_box('page_layout','child_display_portfolio_meta_box'); } function child_display_portfolio_meta_box() {...} and other ways unfortunately, doesn't work...
i want replace function call 3 "templates" (default, full width featured media, without featured media) 1 function , 2 templates.
here code want remove/change, part calling page layout :
function create_portfolio_meta_box() { global $key_portfolio; if( function_exists( 'add_meta_box' ) ) { add_meta_box( 'portfolio-meta-boxes', __('portfolio options','raw'), 'display_portfolio_meta_box', 'udt_portfolio', 'normal', 'high' ); } } function display_portfolio_meta_box() { global $post, $meta_boxes_portfolio, $key_portfolio; ?> <div class="form-wrap"> <?php wp_nonce_field( plugin_basename( __file__ ), $key_portfolio . '_wpnonce', false, true ); foreach($meta_boxes_portfolio $meta_box) { $data = get_post_meta($post->id, $key_portfolio, true); ?> <?php if($meta_box[ 'name' ]=='display_title') { ?> <div class="form-field"> <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label> <input type="text" id="<?php echo $meta_box[ 'name' ]; ?>" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php if(isset($data[ $meta_box[ 'name' ] ])) { echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); } ?>" /> <p><?php echo $meta_box[ 'description' ]; ?></p> </div> <?php } else if($meta_box[ 'name' ]=='teaser') {?> <div class="form-field"> <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label> <textarea id="<?php echo $meta_box[ 'name' ]; ?>" name="<?php echo $meta_box[ 'name' ]; ?>"><?php if(isset($data[ $meta_box[ 'name' ] ])) { echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); } ?></textarea> <p><?php echo $meta_box[ 'description' ]; ?></p> </div> <?php } else if($meta_box[ 'name' ]=='page_layout') { ?> <div class="form-field"> <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label> <select id="<?php echo $meta_box[ 'name' ]; ?>" name="<?php echo $meta_box[ 'name' ]; ?>" style="min-width:200px;"> <option value="default" <?php if(isset($data[$meta_box['name']])) selected($data[$meta_box['name']],'default'); ?>>default</option> <option value="full-width-media" <?php if(isset($data[$meta_box['name']])) selected($data[$meta_box['name']],'full-width-media'); ?>>full width featured media</option> <option value="without-featured-media" <?php if(isset($data[$meta_box['name']])) selected($data[$meta_box['name']],'without-featured-media'); ?>>without featured media</option> </select> <p><?php echo $meta_box[ 'description' ]; ?></p> </div> <?php } else if($meta_box[ 'name' ]=='display_media_caption') { ?> <div class="form-field"> <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label> <input type="text" id="<?php echo $meta_box[ 'name' ]; ?>" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php if(isset($data[ $meta_box[ 'name' ] ])) { echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); } ?>" /> <p><?php echo $meta_box[ 'description' ]; ?></p> </div> <?php } }?> </div>
could explain me wrong tests , me find solution?
thank , sorry "not good" english :)
this tutorial helped me remove metabox wp theme:
hope helps in case.
Comments
Post a Comment