/** * Helper function for getting a post's published date and formatting it to be * displayed in a template. * * @since 1.1.0 * @access public * @param $args array * @return string */ function flagship_get_entry_published($args = array()) { $output = ''; $defaults = apply_filters('flagship_entry_published_defaults', array('before' => '', 'after' => '', 'attr' => 'entry-published', 'date' => get_the_date(), 'wrap' => '<time %s>%s</time>')); $args = wp_parse_args($args, $defaults); $output .= $args['before']; $output .= sprintf($args['wrap'], hybrid_get_attr($args['attr']), $args['date']); $output .= $args['after']; return apply_filters('flagship_entry_published', $output, $args); }
/** * This template tag is meant to replace template tags like `the_category()`, `the_terms()`, etc. These core * WordPress template tags don't offer proper translation and RTL support without having to write a lot of * messy code within the theme's templates. This is why theme developers often have to resort to custom * functions to handle this (even the default WordPress themes do this). Particularly, the core functions * don't allow for theme developers to add the terms as placeholders in the accompanying text (ex: "Posted in %s"). * This funcion is a wrapper for the WordPress `get_the_terms_list()` function. It uses that to build a * better post terms list. * * @author Justin Tadlock * @link https://github.com/justintadlock/hybrid-core/blob/2.0/functions/template-post.php * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * @since 1.0.0 * @param array $args * @return string */ function munsa_lite_get_post_terms($args = array()) { $html = ''; $defaults = array('post_id' => get_the_ID(), 'taxonomy' => 'category', 'text' => '%s', 'before' => '', 'after' => '', 'items_wrap' => '<span %s>%s</span>', 'sep' => _x(' #', 'taxonomy terms separator', 'munsa-lite')); $args = wp_parse_args($args, $defaults); $terms = get_the_term_list($args['post_id'], $args['taxonomy'], '', $args['sep'], ''); if (!empty($terms)) { $html .= $args['before']; $html .= sprintf($args['items_wrap'], 'class="entry-terms ' . $args['taxonomy'] . '" ' . hybrid_get_attr('entry-terms', $args['taxonomy']) . '', sprintf($args['text'], $terms)); $html .= $args['after']; } return $html; }
/** * Helper function to build a newer/older or paginated navigation element within * a loop of multiple entries. This takes care of all the annoying formatting * which usually would need to be done within a template. * * This defaults to a pagination format unless the site is using a version of * WordPress older than 4.1. For older sites, we fall back to the next and * previous post links by default. * * @since 1.3.0 * @access public * @param $args array * @return string */ function flagship_get_posts_navigation($args = array()) { global $wp_query; // Return early if we're on a singular post or we only have one page. if (is_singular() || 1 === $wp_query->max_num_pages) { return; } $defaults = apply_filters('flagship_loop_nav_defaults', array('format' => 'pagination', 'prev_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Previous Page', 'flagship-library')), 'next_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Next Page', 'flagship-library')), 'prev_link_text' => __('Newer Posts', 'flagship-library'), 'next_link_text' => __('Older Posts', 'flagship-library'))); $args = wp_parse_args($args, $defaults); $output = ''; $output .= '<nav ' . hybrid_get_attr('nav', 'archive') . '>'; $output .= sprintf('<span class="nav-previous">%s</span>', get_previous_posts_link($args['prev_link_text'])); $output .= sprintf('<span class="nav-next">%s</span>', get_next_posts_link($args['next_link_text'])); $output .= '</nav><!-- .nav-archive -->'; if (function_exists('the_posts_pagination') && 'pagination' === $args['format']) { $output = get_the_posts_pagination(array('prev_text' => $args['prev_text'], 'next_text' => $args['next_text'])); } return apply_filters('flagship_loop_nav', $output, $args); }
<?php if (is_single()) { // If viewing a single post. $heading = 'h1'; } else { // If not viewing a single post. $heading = 'h2'; } // End single post check. ?> <<?php echo $heading; ?> class="entry-title" <?php echo hybrid_get_attr('entry-title'); ?> > <a href="<?php echo esc_url(toivo_lite_get_link_url()); ?> "><?php the_title(); ?> <span class="meta-nav"><?php echo esc_attr($toivo_left_or_right); ?> </span></a> </<?php echo $heading; ?>
?> <div class="entry-inner"> <header class="entry-header"> <?php get_template_part('entry', 'meta'); // Loads the entry-meta.php template. ?> <?php if (is_single()) { the_title('<h1 class="entry-title" ' . hybrid_get_attr('entry-title') . '>', '</h1>'); } else { the_title(sprintf('<h2 class="entry-title" ' . hybrid_get_attr('entry-title') . '><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); } ?> </header><!-- .entry-header --> <?php if (!is_single() || is_page_template('pages/front-page.php')) { ?> <div class="entry-summary" <?php hybrid_attr('entry-summary'); ?> > <?php the_excerpt();
/** * Widget nav menu attributes. * * @deprecated 1.4.0 * @since 1.0.0 * @access public * @param array $attr * @param string $context * @return array */ function flagship_attr_widget_menu($attr, $context) { _deprecated_function(__FUNCTION__, '1.4.0'); return hybrid_get_attr('menu', $context); }
if (has_post_thumbnail()) { ?> <div class="post-thumbnail"> <?php the_post_thumbnail(); ?> </div><!-- .post-thumbnail --> <?php } ?> <div class="entry-inner"> <header class="entry-header"> <?php the_title('<h1 class="entry-title" ' . hybrid_get_attr('entry-title') . '>', '</h1>'); ?> </header><!-- .entry-header --> <div class="entry-content" <?php hybrid_attr('entry-content'); ?> > <?php the_content(); ?> </div><!-- .entry-content --> </div><!-- .entry-inner --> </article><!-- #post-## -->
/** * Outputs an HTML element's attributes. * * @since 2.0.0 * @access public * @param string $slug The slug/ID of the element (e.g., 'sidebar'). * @param string $context A specific context (e.g., 'primary'). * @param array $attr Array of attributes to pass in (overwrites filters). * @return void */ function hybrid_attr($slug, $context = '', $attr = array()) { echo hybrid_get_attr($slug, $context, $attr); }
<?php printf('<div class="%s">', 'search-meta'); printf('<div %s>', hybrid_get_attr('loop-meta')); printf('<h1 %s>', hybrid_get_attr('loop-title')); echo __('New Search', 'classic'); echo '</h1>'; printf('<div %s>', hybrid_get_attr('loop-description')); printf('<p>'); echo __('If you are not happy with the results below please do another search', 'classic'); echo '</p>'; get_search_form(); // Loads the searchform.php template. echo '</div><!-- .loop-description -->'; echo '</div><!-- .loop-meta -->'; echo '</div><!-- .search-meta -->'; global $wp_query; printf('<div class="%s">', 'alert alert-info'); $page_title = strip_tags(hybrid_get_loop_title()); $page_title = $wp_query->found_posts . " " . $page_title; echo $page_title; echo '</div><!-- .alert .alert-info -->';
/** * This template tag is meant to replace template tags like `the_category()`, `the_terms()`, etc. These core * WordPress template tags don't offer proper translation and RTL support without having to write a lot of * messy code within the theme's templates. This is why theme developers often have to resort to custom * functions to handle this (even the default WordPress themes do this). Particularly, the core functions * don't allow for theme developers to add the terms as placeholders in the accompanying text (ex: "Posted in %s"). * This funcion is a wrapper for the WordPress `get_the_terms_list()` function. It uses that to build a * better post terms list. * * @since 2.0.0 * @access public * @param array $args * @return string */ function hybrid_get_post_terms($args = array()) { $html = ''; $defaults = array('post_id' => get_the_ID(), 'taxonomy' => 'category', 'text' => '%s', 'before' => '', 'after' => '', 'wrap' => '<span %s>%s</span>', 'sep' => _x(', ', 'taxonomy terms separator', 'hybrid-core')); $args = wp_parse_args($args, $defaults); $terms = get_the_term_list($args['post_id'], $args['taxonomy'], '', $args['sep'], ''); if ($terms) { $html .= $args['before']; $html .= sprintf($args['wrap'], hybrid_get_attr('entry-terms', $args['taxonomy']), sprintf($args['text'], $terms)); $html .= $args['after']; } return $html; }
<?php printf('<li %s>', hybrid_get_attr('comment')); printf('<article>'); printf('<header class="%s">', 'comment-meta clearfix'); echo get_avatar($comment, apply_filters('hybopress_comment_gravatar_size', 48)); printf('<cite %s>', hybrid_get_attr('comment-author')); echo get_comment_author_link(); echo '</cite>'; printf('<span class="%s">', 'says sr-only'); echo __('says:', 'getnoticed'); echo '</span><br />'; printf('<a %s>', hybrid_get_attr('comment-permalink')); printf('<time %s>', hybrid_get_attr('comment-published')); printf(__('%1$s at %2$s', 'getnoticed'), get_comment_date(), get_comment_time()); echo '</time>'; echo '</a>'; edit_comment_link(); echo '</header><!-- .comment-meta -->'; printf('<div class="%s">', 'comment-content'); if ('0' == $comment->comment_approved) { printf('<p class="%s">', 'text-info text-uppercase'); printf('<em class="%s">', 'comment-awaiting-moderation'); _e('Your comment is awaiting moderation.', 'getnoticed'); echo '</em>'; echo '</p>'; } comment_text(); echo '<!-- .comment-content -->'; hybrid_comment_reply_link(); echo '</article>';
<?php printf('<li %s>', hybrid_get_attr('comment')); printf('<article>'); printf('<header class="%s">', 'comment-meta clearfix'); echo get_avatar($comment, apply_filters('hybopress_comment_gravatar_size', 60)); hybrid_comment_reply_link(); printf('<cite %s>', hybrid_get_attr('comment-author')); echo get_comment_author_link(); echo '</cite><br />'; printf('<time %s>', hybrid_get_attr('comment-published')); printf(__('%s ago', 'elegant'), human_time_diff(get_comment_time('U'), current_time('timestamp'))); echo '</time>'; printf('<a %s>', hybrid_get_attr('comment-permalink')); _e('Permalink', 'elegant'); echo '</a>'; edit_comment_link(); echo '</header><!-- .comment-meta -->'; printf('<div class="%s">', 'comment-content'); if ('0' == $comment->comment_approved) { printf('<p class="%s">', 'text-info text-uppercase'); printf('<em class="%s">', 'comment-awaiting-moderation'); _e('Your comment is awaiting moderation.', 'elegant'); echo '</em>'; echo '</p>'; } comment_text(); echo '<!-- .comment-content -->'; echo '</article>'; /* No closing </li> is needed. WordPress will know where to add it. */
hybrid_attr('header'); ?> > <div class="header-image"></div> <div class="wrap"> <div <?php hybrid_attr('branding'); ?> > <?php $logo = '<img itemprop="logo" alt="' . get_bloginfo('name') . '" src="' . THEME_IMG_URI . 'logo.png">'; ?> <?php printf('<h1 %s><a href="%s" rel="home">%s</a></h1>', hybrid_get_attr('site-title'), esc_url(home_url()), $logo); ?> <span class="screen-reader-text" itemprop="name"><?php bloginfo('name'); ?> </span> </div><!-- #branding --> <?php hybrid_get_menu('primary'); // Loads the menu/primary.php template. ?> <?php //hybrid_get_menu( 'primary-mobile' ); // Loads the menu/primary-mobile.php template. ?>
<?php // Testimonials area $testimonials = new WP_Query(apply_filters('toivo_lite_testimonials_arguments', array('post_type' => 'jetpack-testimonial', 'orderby' => 'rand', 'posts_per_page' => 4, 'no_found_rows' => true))); ?> <?php if ($testimonials->have_posts()) { ?> <div id="testimonial-area" class="testimonial-area front-page-area"> <?php $jetpack_options = get_theme_mod('jetpack_testimonials'); $toivo_lite_testimonial_heading = $jetpack_options['page-title'] ? esc_html($jetpack_options['page-title']) : esc_html__('Testimonials', 'toivo-lite'); echo '<h2 class="entry-title" ' . hybrid_get_attr('entry-title') . '>' . $toivo_lite_testimonial_heading . '</h2>'; ?> <div class="testimonial-wrapper"> <?php while ($testimonials->have_posts()) { $testimonials->the_post(); ?> <?php get_template_part('content', 'jetpack-testimonial'); ?> <?php }
<article <?php hybrid_attr('post'); ?> > <?php $time = sprintf("<time %s>%s</time>", hybrid_get_attr('entry-published'), get_the_date('j F Y')); ?> <?php if (is_singular()) { // If a single post. ?> <header class="entry-header"> <h1 <?php hybrid_attr('entry-title'); ?> ><?php the_title(); ?> </h1> </header> <div <?php hybrid_attr('entry-content'); ?> > <?php the_content();
/** * Returns the site description wrapped in an `<h2>` tag. * * @since 2.0.0 * @access public * @return string */ function hybrid_get_site_description() { if ($desc = get_bloginfo('description')) { $desc = sprintf('<h2 %s>%s</h2>', hybrid_get_attr('site-description'), $desc); } return apply_filters('hybrid_site_description', $desc); }
* The secondary nav menu template. * * @package Compass * @subpackage HybridCore * @copyright Copyright (c) 2015, Flagship Software, LLC * @license GPL-2.0+ * @since 1.0.0 */ if (has_nav_menu('secondary')) { ?> <nav <?php hybrid_attr('menu', 'secondary'); ?> > <span id="menu-secondary-title" class="screen-reader-text"> <?php // Translators: %s is the nav menu name. This is the nav menu title shown to screen readers. printf(_x('%s', 'nav menu title', 'compass'), hybrid_get_menu_location_name('secondary')); ?> </span> <?php wp_nav_menu(array('theme_location' => 'secondary', 'container' => '', 'menu_id' => 'secondary', 'menu_class' => 'nav-menu secondary', 'fallback_cb' => '', 'items_wrap' => '<div ' . hybrid_get_attr('wrap', 'secondary-menu') . '><ul id="%s" class="%s">%s</ul></div>')); ?> </nav><!-- #menu-secondary --> <?php }
<?php hybrid_post_terms(array('taxonomy' => 'category', 'text' => __('Posted in %s', 'infusion'))); ?> <?php hybrid_post_terms(array('taxonomy' => 'post_tag', 'text' => __('Tagged %s', 'infusion'), 'before' => '<br />')); ?> </footer> <?php } else { // If not viewing a single post. ?> <header class="entry-header"> <?php the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a href="' . hybrid_get_the_post_format_url() . '">', is_rtl() ? ' <span class="meta-nav">←</span>' : ' <span class="meta-nav">→</span>' . '</a></h2>'); ?> </header> <footer class="entry-footer"> <?php hybrid_post_format_link(); ?> <time <?php hybrid_attr('entry-published'); ?> ><?php echo get_the_date(); ?> </time> <a class="entry-permalink" href="<?php
/** * Wrap the header navigation menu in its own nav tags with markup API. * * @since 1.0.0 * @param $menu Menu output. * @return string $menu Modified menu output. */ function flagship_header_menu_wrap($menu) { return sprintf('<nav %s>', hybrid_get_attr('widget-menu', 'header')) . $menu . '</nav>'; }
/** * Outputs an HTML element's attributes. * * @since 2.0.0 * @access public * @param string $slug The slug/ID of the element (e.g., 'sidebar'). * @param string $context A specific context (e.g., 'primary'). * @return void */ function hybrid_attr($slug, $context = '') { echo hybrid_get_attr($slug, $context); }
/** * Outputs the content for the current widget instance. */ public function widget($args, $instance) { /** * Combine $instance data with defaults * Then extract variables of this array */ extract(wp_parse_args($instance, array('image_id' => '', 'icon' => '', 'title' => '', 'text' => '', 'number_of_posts' => 3))); /* Run $text through filter */ $text = apply_filters('widget_text', $text, $instance, $this); /* Get Url of blog section */ $url = get_option('show_on_front') == 'page' ? get_permalink(get_option('page_for_posts')) : bloginfo('url'); ?> <?php echo $args['before_widget']; ?> <?php if (!empty($image_id)) { // Check if there is an image_id ?> <div class="featured-image-container"> <?php echo wp_get_attachment_image($image_id, 'featured', false, array('class' => 'featured-image')); ?> </div> <?php if (!empty($icon)) { // Check if there is an icon ?> <div class="icon-container"> <i class="fa fa-<?php echo $icon; ?> "></i> </div> <?php } // END icon check ?> <?php } // END image_id check ?> <?php echo $args['before_title']; ?> <a href="<?php echo $url; ?> "><?php echo $title; ?> </a><?php echo $args['after_title']; ?> <?php if (!empty($text)) { // Check if there is text ?> <div class="textwidget"><?php echo wpautop($text); ?> </div> <?php } // END text check ?> <?php /* Get articles of current knowledgebase category */ $recent_posts_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number_of_posts, 'orderby' => 'post_date', 'order' => 'DESC')); ?> <?php if ($recent_posts_query->have_posts()) { // Checks if any posts were found. ?> <div class="recent-posts"> <?php while ($recent_posts_query->have_posts()) { // Begins the loop through found posts. ?> <?php $recent_posts_query->the_post(); // Loads the post data. ?> <?php $post_date = sprintf("<time %s>%s</time>", hybrid_get_attr('entry-published'), get_the_date('j F Y')); ?> <article <?php hybrid_attr('post'); ?> > <div class="entry-byline"> <?php echo $post_date; ?> • <?php hybrid_post_terms(array('taxonomy' => 'category')); ?> </div> <header class="entry-header"> <h4 <?php hybrid_attr('entry-title'); ?> ><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark" itemprop="url"><?php the_title(); ?> </a></h4> </header> </article> <?php } // End found posts loop. ?> </div> <?php wp_reset_postdata(); ?> <?php } // End check for posts. ?> <?php echo $args['after_widget']; ?> <?php }
<?php // Testimonials area $testimonials = new WP_Query(apply_filters('chuchadon_testimonials_arguments', array('post_type' => 'jetpack-testimonial', 'orderby' => 'rand', 'posts_per_page' => 4, 'no_found_rows' => true))); ?> <?php if ($testimonials->have_posts()) { ?> <div id="testimonial-area" class="testimonial-area front-page-area"> <?php $jetpack_options = get_theme_mod('jetpack_testimonials'); $chuchadon_testimonial_heading = $jetpack_options['page-title'] ? esc_html($jetpack_options['page-title']) : esc_html__('Testimonials', 'chuchadon'); echo '<h2 class="entry-title" ' . hybrid_get_attr('entry-title') . '>' . $chuchadon_testimonial_heading . '</h2>'; ?> <div class="testimonial-wrapper"> <?php while ($testimonials->have_posts()) { $testimonials->the_post(); ?> <?php get_template_part('template-parts/content', 'jetpack-testimonial'); ?> <?php }
/** Output iKoreaTown site title. * * * @since 0.1.0 */ function kt_site_title() { $title = sprintf('<h1 %s><a href="%s" rel="home"></a></h1>', hybrid_get_attr('site-title'), home_url()); echo $title; }
<div <?php hybrid_attr('entry-summary'); ?> > <a href="<?php thds_theme_url(); ?> "> <?php thds_theme_excerpt(); ?> </a> </div><!-- .entry-summary --> <footer class="entry-footer"> <?php the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>'); ?> <?php printf('<a class="demo-link" href="%s" target="_blank">%s</a>', esc_url(thds_get_theme_demo_url()), __('Demo', 'magikpress')); ?> </footer><!-- .entry-footer --> <?php } // End single post check. ?> </article><!-- .entry -->
?> <br/> </span> </time> </div><!-- .entry-published-wrap --> <div class="comment-link-wrap"> <?php comments_popup_link(number_format_i18n(0), number_format_i18n(1), '%', 'comments-link', ''); ?> </div><!-- .comment-link-wrap --> <header class="entry-header"> <?php the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a class="format-link-title" href="' . hybrid_get_the_post_format_url() . '" rel="bookmark" itemprop="url">', '</a></h2>'); ?> <?php edit_post_link(); ?> </header><!-- .entry-header --> <?php if (is_singular()) { ?> <div <?php hybrid_attr('entry-content'); ?> >