Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function flourish_options_panel(){
- add_meta_box('flourish_options_panel',__('Theme Options','flourish'),'flourish_options_callback','post','advanced','high');
- add_meta_box('flourish_options_panel',__('Theme Options','flourish'),'flourish_options_callback','page','advanced','high');
- }
- add_action('add_meta_boxes','flourish_options_panel');
- //this modifies the options block at the bottom of page/post pages
- function flourish_options_callback( $post ) {
- wp_nonce_field( basename( __FILE__ ), 'flourish_nonce' );
- $prfx_stored_meta = get_post_meta( $post->ID );
- ?>
- <p>
- <label for="header_opacity" class="prfx-row-title"><?php _e( 'Header Overlay Transparency', 'flourish' )?></label>
- <input type="text" name="header_opacity" id="header_opacity" value="<?php if ( isset ( $prfx_stored_meta['header_opacity'] ) ) echo $prfx_stored_meta['header_opacity'][0]; ?>" /> <small><?php _e( 'Enter a value between .00 and 1', 'flourish' )?></small>
- </p>
- <p>
- <label for="header_style" class="prfx-row-title"><?php _e( 'Header Display Style', 'flourish' )?></label>
- <select name="header_style" id="header_style">
- <option value="" <?php if ( isset ( $prfx_stored_meta['header_style'] ) ) selected( $prfx_stored_meta['header_style'][0], '' ); ?>><?php _e( 'Default', 'flourish' )?></option>';
- <option value="large-display" <?php if ( isset ( $prfx_stored_meta['header_style'] ) ) selected( $prfx_stored_meta['header_style'][0], 'large-display' ); ?>><?php _e( 'Large', 'flourish' )?></option>';
- <option value="standard-display" <?php if ( isset ( $prfx_stored_meta['header_style'] ) ) selected( $prfx_stored_meta['header_style'][0], 'standard-display' ); ?>><?php _e( 'Standard', 'flourish' )?></option>';
- </select>
- </p>
- <p>
- <label>
- <?php _e('Add this page/post to Front Page Widget','flourish') ?>
- <input type="checkbox" <?php if ($prfx_stored_meta['flourish_fpFeatured'][0]==1){ ?> checked="checked" <?php } ?> name="flourish_fp_featured" id="flourish_fp_featured">
- </label>
- </p>
- <p>
- <label>
- <?php _e('Disable Featured Image in Header','flourish') ?>
- <input type="checkbox" name="flourish_display_image_feature" <?php echo ($prfx_stored_meta['flourish_display_image_feature'][0]==1)?'checked':''?> />
- </label>
- </p>
- <p>
- <label>
- <?php _e('Hide the page title','flourish') ?>
- <input type="checkbox" name="flourish_display_title" <?php echo ($prfx_stored_meta['flourish_display_title'][0]==1)?'checked':'' ?>/>
- </label>
- </p>
- <?php
- }
- function flourish_options_save($postid){
- $is_autosave = wp_is_post_autosave($postid);
- $is_revision = wp_is_post_revision($postid);
- $is_valid_nonce = (isset($_POST['flourish_nonce']) && (bool)wp_verify_nonce($_POST[ 'flourish_nonce' ],basename( __FILE__ )));
- if ($is_autosave||$is_revision|| !$is_valid_nonce)
- return;
- if (isset($_POST['header_opacity']))
- update_post_meta($postid,'header_opacity',sanitize_text_field($_POST['header_opacity']));
- if (isset($_POST['header_style']))
- update_post_meta($postid,'header_style',sanitize_text_field($_POST['header_style']));
- if (isset($_POST['flourish_fp_featured']))
- update_post_meta($postid,'flourish_fpFeatured',1);
- else
- update_post_meta($postid,'flourish_fpFeatured',0);
- if (isset($_POST['flourish_display_image_feature']))
- update_post_meta($postid,'flourish_display_image_feature',1);
- else
- update_post_meta($postid,'flourish_display_image_feature',0);
- if (isset($_POST['flourish_display_title']))
- update_post_meta($postid,'flourish_display_title',1);
- else
- update_post_meta($postid,'flourish_display_title',0);
- }
- add_action('save_post','flourish_options_save');
- //silence ellipsis
- function flourish_excerpt_more($more){
- return '';
- }
- add_filter( 'excerpt_more', 'flourish_excerpt_more' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement