* @license GPL-2.0+ * @link http://rahularyan.com * @copyright 2014 Rahul Aryan */ class anspress_shortcodes extends anspress { /** * Instance of this class. */ protected static $instance = null; /** * Return an instance of this class. * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } public function __construct(){ add_shortcode('anspress_base', array($this, 'anspress_base')); add_shortcode('anspress_ask', array($this, 'anspress_ask')); add_shortcode('anspress_edit_q', array($this, 'anspress_edit_q')); add_shortcode('anspress_edit_a', array($this, 'anspress_edit_a')); } public function anspress_base( $atts ) { ob_start(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array('post_type'=>'question', 'paged' => $paged)); include(ap_get_theme_location('index.php')); wp_reset_query(); return ob_get_clean(); } public function anspress_ask( $atts ) { ob_start(); include(ap_get_theme_location('ask.php')); return ob_get_clean(); } public function anspress_edit_q( $atts ) { ob_start(); include(ap_get_theme_location('edit-question.php')); return ob_get_clean(); } public function anspress_edit_a( $atts ) { ob_start(); include(ap_get_theme_location('edit-answer.php')); return ob_get_clean(); } }