/** * Constructor */ public function __construct() { $this->_recent_posts = PF_Recent_Posts_init(); $this->_featured_posts = PF_Featured_Posts_init(); $this->_popular_posts = PF_Popular_Posts_init(); $this->_related_posts = PF_Related_Posts_init(); add_shortcode(self::RECENT_POSTS_SC, array(&$this, 'process_recent_posts_sc')); add_shortcode(self::POPULAR_POSTS_SC, array(&$this, 'process_popular_posts_sc')); add_shortcode(self::FEATURED_POSTS_SC, array(&$this, 'process_featured_posts_sc')); add_shortcode(self::RELATED_POSTS_SC, array(&$this, 'process_related_posts_sc')); }
{ if (!isset($_POST['pf_featured_meta_box_nonce'])) { return; } // Verify that the nonce is valid. if (!wp_verify_nonce($_POST['pf_featured_meta_box_nonce'], 'pf_featured_save_meta_box_data')) { return; } // If this is an autosave, our form has not been submitted, so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } /* OK, it's safe for us to save the data now. */ // Sanitize user input. $my_data = sanitize_text_field(isset($_POST['pf_featured_meta']) ? $_POST['pf_featured_meta'] : 0); // Update the meta field in the database. update_post_meta($post_id, 'pf_featured_meta', $my_data); } public function get_featured_posts($args) { $args['meta_query'] = array(array('key' => 'pf_featured_meta', 'value' => 1, 'compare' => '=')); $args['ignore_sticky_posts'] = 1; return apply_filters('pf_recent_posts_result', new WP_Query($args), $args); } } function PF_Featured_Posts_init() { return PF_Featured_Posts::get_instance(); } $pf_featured_posts = PF_Featured_Posts_init(); }