<?php /** * For the full license information, please view the Licensing folder * that was distributed with this source code. * * @package G1_Theme03 * @subpackage G1_Relations_Module * @since G1_Relations_Module 1.0.0 */ // Prevent direct script access if (!defined('ABSPATH')) { die('No direct script access allowed'); } require_once trailingslashit(dirname(__FILE__)) . 'lib/functions.php'; /** * Quasi-singleton for our module * * @return G1_Relations_Module */ function G1_Relations_Module() { static $instance; if (!isset($instance)) { $instance = new G1_Relations_Module(); } return $instance; } // Fire in the hole :) G1_Relations_Module();
protected function get_query() { $max = $this->get_attribute('max')->get_value(); $entry_id = $this->get_attribute('entry_id')->get_value(); $related_ids = G1_Relations_Module()->get_related_ids($entry_id, $this->get_post_type(), $max); if (count($related_ids)) { $query_args = array('posts_per_page' => 100, 'post_type' => $this->get_post_type(), 'post__in' => $related_ids, 'orderby' => 'post__in', 'ignore_sticky_posts' => true); } else { $query_args = array(); } $query = new WP_Query($query_args); return $query; }