예제 #1
0
 /**
  * Shortcode to display this post type's posts within a page. #YAWPH
  *
  * The shortcode itself runs a loop within the current loop and restores the
  * original when it's done. This allows us to show the content of whatever page
  * shows the archives in addition to the archives.
  *
  * Passing attributes add to the query.
  *
  * ### Default query:
  * - `numberofposts` -1 Shows all posts
  *
  * @param array $attrs Shortcode attributes
  * @return string Post type's archives
  */
 public function shortcode($attrs = array())
 {
     global $wp_query, $wp_rewrite;
     $_old_query = $wp_query;
     $query = $this->archiveQuery;
     $query['post_type'] = $this->name;
     if (isset($attrs['campus'])) {
         switch_to_blog($attrs['campus']);
     }
     $wp_query = new WP_Query($query);
     $wp_query->query($query);
     // we have to gobble this up and return it so it doesn't just print everywhere
     ob_start();
     // loop within loop
     while (have_posts()) {
         the_post();
         get_template_part('content', $this->options['slug']);
     }
     $this->theme->set('wp_rewrite', $wp_rewrite);
     $this->theme->set('wp_query', $wp_query);
     echo $this->theme->render('pagination');
     $return = ob_get_clean();
     // back to the old query
     $wp_query = $_old_query;
     if (isset($attrs['campus'])) {
         restore_current_blog();
     }
     return $return;
 }
예제 #2
0
/**
 * Renders a video
 *
 * ### Attrs:
 * - string $src The video source
 *
 * @param array $attr Attributes sent by WordPress defined in the editor
 * @return string
 */
	public function video($attr) {
		$this->theme->set(shortcode_atts(array(
			'src' => null,
			'poster' => null,
			'campus' => null
		), $attr));
		return $this->theme->render('video');
	}
예제 #3
0
 /**
  * Renders the backend widget form
  * 
  * @param array $data Database values provided in backend
  */
 public function form($data)
 {
     $_defaults = array('title' => 'Widget');
     $data = array_merge($_defaults, $data);
     // need to use methods in this class to generate fields
     $this->theme->set('widget', $this);
     $this->theme->set('data', $data);
     echo $this->theme->render('admin' . DS . 'widgets' . DS . $this->settings['base_id']);
 }
예제 #4
0
 /**
  * Renders the template options meta box
  */
 public function templateOptionsMetabox()
 {
     global $post;
     $this->theme->set('data', $this->theme->metaToData($post->ID));
     echo $this->theme->render('admin' . DS . 'template_options_meta_box');
 }