Esempio n. 1
0
 /**
  * Callback function on settings page load
  */
 public function on_page_settings_load()
 {
     if (isset($_POST['fa_nonce']) && check_admin_referer('fapro_save_settings', 'fa_nonce')) {
         if (!current_user_can('manage_options')) {
             wp_die(__('Sorry, you are not allowed to do this.', 'fapro'), __('Access denied', 'fapro'));
         }
         // update general settings
         $result = fa_update_options('settings', $_POST);
         if (is_wp_error($result)) {
             $this->errors = $result;
         }
         if (is_wp_error($result)) {
             $this->errors = $result;
         }
         $this->save_caps();
         if (!$this->errors && !is_wp_error($this->errors)) {
             $url = add_query_arg(array('message' => 801), html_entity_decode(menu_page_url('fapro_settings')));
             wp_redirect($url);
             die;
         }
     }
     fa_load_template_style('settings');
     fa_load_admin_script('tabs', array('jquery', 'jquery-ui-tabs'));
 }
Esempio n. 2
0
/**
 * Output the image attached to a slide
 * @param int $post_id
 */
function the_fa_slide_image($post_id)
{
    $post_id = absint($post_id);
    $options = fa_get_slide_options($post_id);
    $image = false;
    if ($options['image']) {
        $image = wp_get_attachment_image($options['image'], 'thumbnail');
    }
    // always enqueue the media gallery scripts
    wp_enqueue_media();
    fa_load_admin_script('media-gallery');
    ?>
	
<div id="fa-selected-images">
<?php 
    if ($image) {
        ?>
	<div class="fa-slide-image" data-post_id="<?php 
        echo $options['image'];
        ?>
">		
		<?php 
        $args = array('page_title' => __('Select image to use in slide', 'fapro'), 'button_text' => $image, 'select_multiple' => false, 'class' => 'fa-img');
        fa_media_gallery($args);
        ?>
			
	</div>
	<a href="#" id="fa-remove-slide-image" data-post_id=<?php 
        echo $post_id;
        ?>
><?php 
        _e('Remove image', 'fapro');
        ?>
</a>	
<?php 
    } else {
        // show the image select button
        ?>
	<?php 
        $args = array('page_title' => __('Select image to use in slide', 'fapro'), 'button_text' => __('Select image', 'fapro'), 'select_multiple' => false);
        fa_media_gallery($args);
    }
    // if($image)
    ?>
</div>
<?php 
}
Esempio n. 3
0
 /**
  * Register alternative meta box for WP version prior to WP 4
  * @param string $post_type
  * @param object $post
  */
 public function register_slider_shortcode_meta_box($post_type, $post)
 {
     if (parent::get_type_slider() == $post_type) {
         return;
     }
     // Slide video attachment meta box
     add_meta_box($this->meta_box_prefix . '-slider-shortcode', __('Featured Articles Lite - slider shortcode', 'fapro'), array($this, 'meta_box_slider_shortcode'), null, 'side');
     fa_load_admin_script('insert-shortcode');
 }