Untitled
unknown
php
a year ago
1.9 kB
4
Indexable
Never
<?php } function add_meta_box_sermon(){ add_meta_box( 'sermon_meta', 'Sermon Options', 'meta_box_sermon', 'sermon', 'normal', 'high' ); } add_action( 'add_meta_boxes', 'add_meta_box_sermon' ); // meta box end // meta box saving start if ( isset($_POST['sermon_meta_form']) and $_POST['sermon_meta_form'] == 1 ) { add_action( 'save_post', 'cs_meta_post_save' ); function cs_meta_post_save( $post_id ) { if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( empty($_POST['sermon_audio_url']) ) $_POST['sermon_audio_url'] = ""; if ( empty($_POST['sermon_download_url']) ) $_POST['sermon_download_url'] = ""; if ( empty($_POST['sermon_script_url']) ) $_POST['sermon_script_url'] = ""; if ( empty($_POST['sermon_social_sharing']) ) $_POST['sermon_social_sharing'] = ""; if ( empty($_POST['sermon_buy_url']) ) $_POST['sermon_buy_url'] = ""; if ( empty($_POST['sermon_price_amount']) ) $_POST['sermon_price_amount'] = ""; if ( empty($_POST['sermon_author_description']) ) $_POST['sermon_author_description'] = ""; $sxe = new SimpleXMLElement("<cs_meta_sermon></cs_meta_sermon>"); $sxe->addChild('sermon_audio_url', $_POST['sermon_audio_url'] ); $sxe->addChild('sermon_download_url', $_POST['sermon_download_url'] ); $sxe->addChild('sermon_script_url', $_POST['sermon_script_url'] ); $sxe->addChild('sermon_social_sharing', $_POST['sermon_social_sharing'] ); $sxe->addChild('sermon_buy_url', $_POST['sermon_buy_url'] ); $sxe->addChild('sermon_price_amount', $_POST['sermon_price_amount'] ); $sxe->addChild('sermon_author_description', $_POST['sermon_author_description'] ); $sxe = save_layout_xml($sxe); update_post_meta( $post_id, 'cs_sermon', $sxe->asXML() ); } } // meta box saving end ?>