/** * Rewrite a single option. * * @since 1.0.0 */ public function get_single_option($value, $object_id) { if (CHERRY_PORTFOLIO_NAME != get_post_type($object_id)) { return $value; } return Cherry_Portfolio_Data::cherry_portfolio_get_option('single-portfolio-layout', 'no-sidebar'); }
<?php /** * The Template for displaying single CPT Portfolio. * */ while (have_posts()) { the_post(); ?> <article <?php if (function_exists('cherry_attr')) { cherry_attr('post'); } ?> > <?php do_action('cherry_entry_before'); $data = new Cherry_Portfolio_Data(); $data->portfolio_single_data(); ?> </article> <?php do_action('cherry_entry_after'); ?> <?php }
/** * Restores the static $postdata. * * @since 1.0.0 * @return array */ public static function reset_postdata() { self::$postdata = array(); }
/** * The shortcode function. * * @since 1.0.0 * @param array $atts The user-inputted arguments. * @param string $content The enclosed content (if the shortcode is used in its enclosing form). * @param string $shortcode The shortcode tag, useful for shared callback functions. * @return string */ public function do_shortcode($atts, $content = null, $shortcode = '') { // Set up the default arguments. $defaults = array('listing_layout' => 'masonry-layout', 'loading_mode' => 'portfolio-ajax-pagination-mode', 'loading_animation' => 'loading-animation-move-up', 'filter_visible' => 'yes', 'order_filter_visible' => 'no', 'posts_per_page' => 9, 'grid_col' => 3, 'item_margin' => 4, 'echo' => false, 'template' => '', 'posts_format' => 'post-format-all', 'custom_class' => ''); /** * Parse the arguments. * * @link http://codex.wordpress.org/Function_Reference/shortcode_atts */ $atts = shortcode_atts($defaults, $atts, $shortcode); $atts['filter_visible'] = (bool) ($atts['filter_visible'] === 'yes') ? true : false; $atts['order_filter_visible'] = (bool) ($atts['order_filter_visible'] === 'yes') ? true : false; // Make sure we return and don't echo. $atts['echo'] = false; parent::__construct(); return $this->the_portfolio($atts); }
/** * Template Name: Portfolio * * The template for displaying CPT Portfolio. * * @package Cherry_Portfolio * @since 1.0.0 */ if (have_posts()) { while (have_posts()) { the_post(); ?> <article <?php if (function_exists('cherry_attr')) { cherry_attr('post'); } ?> > <?php the_content(); $data = new Cherry_Portfolio_Data(); $data->the_portfolio(); ?> </article> <?php } }