/** * Add a class to the bounding div if a post uses an avatar with the author byline. * * @since 1.0.11. * * @param array $classes An array of post classes. * @param string $class A comma-separated list of additional classes added to the post. * @param int $post_ID The post ID. * @return array The modified post class array. */ function ttfmake_maybe_add_with_avatar_class($classes, $class, $post_ID) { $author_key = 'layout-' . ttfmake_get_view() . '-post-author'; $author_option = ttfmake_sanitize_choice(get_theme_mod($author_key, ttfmake_get_default($author_key)), $author_key); if ('avatar' === $author_option) { $classes[] = 'has-author-avatar'; } return $classes; }
<?php /** * @package Make */ $thumb_key = 'layout-' . ttfmake_get_view() . '-featured-images'; $thumb_option = ttfmake_sanitize_choice(get_theme_mod($thumb_key, ttfmake_get_default($thumb_key)), $thumb_key); // Header ob_start(); get_template_part('partials/entry', 'meta-top'); get_template_part('partials/entry', 'sticky'); if ('post-header' === $thumb_option) { get_template_part('partials/entry', 'thumbnail'); } get_template_part('partials/entry', 'title'); get_template_part('partials/entry', 'meta-before-content'); $entry_header = trim(ob_get_clean()); // Footer ob_start(); get_template_part('partials/entry', 'meta-post-footer'); get_template_part('partials/entry', 'taxonomy'); get_template_part('partials/entry', 'sharing'); $entry_footer = trim(ob_get_clean()); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?>
<?php /** * @package Make */ global $ttfmake_current_location; $author_layout_key = 'layout-' . ttfmake_get_view() . '-post-author-location'; $author_option = ttfmake_sanitize_choice(get_theme_mod($author_layout_key, ttfmake_get_default($author_layout_key)), $author_layout_key); $date_layout_key = 'layout-' . ttfmake_get_view() . '-post-date-location'; $date_option = ttfmake_sanitize_choice(get_theme_mod($date_layout_key, ttfmake_get_default($date_layout_key)), $date_layout_key); $comment_count_layout_key = 'layout-' . ttfmake_get_view() . '-comment-count-location'; $comment_count_option = ttfmake_sanitize_choice(get_theme_mod($comment_count_layout_key, ttfmake_get_default($comment_count_layout_key)), $comment_count_layout_key); if ($ttfmake_current_location === $author_option) { get_template_part('partials/entry', 'author'); } if ($ttfmake_current_location === $comment_count_option) { get_template_part('partials/entry', 'comment-count'); } if ($ttfmake_current_location === $date_option) { get_template_part('partials/entry', 'date'); }
/** * Generate a CSS rule definition array for an element's link underline property. * * @since 1.5.0. * * @param string $element The element to look up in the theme options. * @param array $selectors The base selectors to use for the rule. * @return array A CSS rule definition array. */ function ttfmake_parse_link_underline($element, $selectors) { $setting_id = 'link-underline-' . $element; $value = get_theme_mod($setting_id, ttfmake_get_default($setting_id)); if (false !== $value && $value !== ttfmake_get_default($setting_id)) { $sanitized_value = ttfmake_sanitize_choice($value, $setting_id); // Declarations $declarations = array('text-decoration' => 'underline'); if ('never' === $sanitized_value) { $declarations['text-decoration'] = 'none'; } // Selectors $parsed_selectors = $selectors; if ('hover' === $sanitized_value) { foreach ($selectors as $key => $selector) { $parsed_selectors[$key] = $selector . ':hover'; $parsed_selectors[] = $selector . ':focus'; } } // Return CSS rule array return array('selectors' => $parsed_selectors, 'declarations' => $declarations); } return array(); }
<?php /** * @package Make */ $date_key = 'layout-' . ttfmake_get_view() . '-post-date'; $date_option = ttfmake_sanitize_choice(get_theme_mod($date_key, ttfmake_get_default($date_key)), $date_key); // Get date string $date_string = get_the_date(); if ('relative' === $date_option) { $date_string = sprintf(__('%s ago', 'make'), human_time_diff(get_the_time('U'), current_time('timestamp'))); } // Add permalink if not single view if (!is_singular()) { $date_string = '<a href="' . get_permalink() . '" rel="bookmark">' . $date_string . '</a>'; } ?> <?php if ('none' !== $date_option) { ?> <time class="entry-date published" datetime="<?php the_time('c'); ?> "><?php echo $date_string; ?> </time> <?php }
<?php /** * @package Make */ $author_key = 'layout-' . ttfmake_get_view() . '-post-author'; $author_option = ttfmake_sanitize_choice(get_theme_mod($author_key, ttfmake_get_default($author_key)), $author_key); ?> <?php if ('none' !== $author_option) { ?> <div class="entry-author"> <?php if ('avatar' === $author_option) { ?> <div class="entry-author-avatar"> <?php printf('<a class="vcard" href="%1$s">%2$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_avatar(get_the_author_meta('ID'))); ?> </div> <?php } ?> <div class="entry-author-byline"> <?php printf(_x('by %s', 'author byline', 'make'), sprintf('<a class="vcard fn" href="%1$s">%2$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author_meta('display_name')))); ?> </div> <?php if (is_singular() && ($author_bio = get_the_author_meta('description'))) {