/** * Render Custom Movie Archives pages. * * This is basically a call the to movie grid method with a few * preset options. * * @since 2.1 * * @return string HTML markup */ public static function movie_archives() { $has_menu = wpmoly_o('movie-archives-menu', $default = true); $editable = wpmoly_o('movie-archives-frontend-edit', $default = true); global $wp_query; $params = self::parse_query_vars($wp_query->query); extract($params); $grid_menu = ''; if ($has_menu) { $args = compact('columns', 'rows', 'number', 'order', 'orderby', 'editable', 'letter', 'view'); $grid_menu = WPMOLY_Grid::get_menu($args); } $args = compact('number', 'paged', 'order', 'orderby', 'columns', 'rows', 'letter', 'meta', 'detail', 'value', 'view'); $grid = WPMOLY_Grid::get_content($args); $content = $grid_menu . $grid; return $content; }
/** * Movie grid shortcode. * * @since 2.0 * * @param array Shortcode attributes * @param string Shortcode content * * @return string Shortcode display */ public static function movie_grid_shortcode($atts = array(), $content = null) { $atts = self::filter_shortcode_atts('movie_grid', $atts); // Shortcode not working properly on Posts if ('page' != get_post_type()) { $notive = ''; if (current_user_can('manage_options')) { $notive = sprintf('<p><em>%s</em></p>', sprintf(__('The Movie Grid can not be used on regular Posts (<a href="%s">learn why</a>), please consider using a Page instead. This message is visible by logged in administrators only.', 'wpmovielibrary'), esc_url('http://wpmovielibrary.com/documentation/shortcodes/movie_grid/'))); } return $notive; } // Caching $name = apply_filters('wpmoly_cache_name', 'movie_grid_shortcode', $atts); $content = WPMOLY_Cache::output($name, function () use($atts, $content) { extract($atts); $grid_menu = ''; if ($menu) { $grid_menu = WPMOLY_Grid::get_menu($atts, $shortcode = true); } $content = WPMOLY_Grid::get_content($atts, $shortcode = true); $content = $grid_menu . $content; return $content; }, $echo = false); return $content; }