/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { global $mp_stacks_widget_stacks; extract($args); $title = apply_filters('mp_stacks_widget_title', isset($instance['title']) ? $instance['title'] : ''); /** * Widget Start and Title */ echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } /** * Before Hook */ do_action('mp_stacks_widget_start'); /** * Widget Body */ echo mp_stack($instance['stack_id']); //Add this stack to the list of stacks in widgets so we can output the css in the footer $mp_stacks_widget_stacks[$instance['stack_id']] = $instance['stack_id']; /** * After Hook */ do_action('mp_stacks_widget_end'); /** * Widget End */ echo $after_widget; }
/** * Shortcode which is used to display the HTML content on a post */ function mp_stacks_display_mp_stack($atts) { $vars = shortcode_atts(array('stack' => NULL), $atts); //Return the stack HTML output - pass the function the stack id return mp_stack($vars['stack']); }
/** * Function which return a template array for a stack * Parameter: Stack ID * Parameter: $args */ function mp_stack_only_page() { global $wp_query; if (isset($wp_query->query_vars['mp_stack_only_page'])) { $stack = get_term_by('slug', $wp_query->query_vars['mp_stack_only_page'], 'mp_stacks'); ?> <!DOCTYPE html> <html <?php language_attributes(); ?> > <head> <meta charset="<?php bloginfo('charset'); ?> " /> <title><?php wp_title('|', true, 'right'); ?> </title> <link rel="profile" href="//gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> " /> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?> /js/html5.js" type="text/javascript"></script> <![endif]--> <?php mp_stack_css($stack->term_id, true); ?> <?php wp_head(); ?> </head> <body class="body-mp-stack-only-<?php echo $stack->term_id; ?> "> <?php echo mp_stack($stack->term_id); ?> <div style="display:none;"> <?php wp_footer(); ?> </div> </body> </html> <?php die; } }