예제 #1
0
파일: layout.php 프로젝트: fovoc/make
 /**
  * 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;
 }
예제 #2
0
/**
 * Output the site region (header or footer) markup if the current view calls for it.
 * ADD some hooks that I can use before and after
 *
 * @since  1.0.0.
 *
 * @param  string    $region    Region to maybe show.
 * @return void
 */
function ttfmake_maybe_show_site_region($region)
{
    if (!in_array($region, array('header', 'footer'))) {
        return;
    }
    // Get the view
    $view = ttfmake_get_view();
    // Get the relevant option
    $hide_region = (bool) get_theme_mod('layout-' . $view . '-hide-' . $region, ttfmake_get_default('layout-' . $view . '-hide-' . $region));
    do_action('ttfmake_before_' . $region, $hide_region);
    if (true !== $hide_region) {
        get_template_part('partials/' . $region . '-layout', get_theme_mod($region . '-layout', ttfmake_get_default($region . '-layout')));
    }
    do_action('ttfmake_after_' . $region, $hide_region);
}
예제 #3
0
파일: jetpack.php 프로젝트: fovoc/make
 /**
  * Determine whether any footer widgets are actually showing.
  *
  * @since  1.0.0.
  *
  * @return bool    Whether or not infinite scroll has footer widgets.
  */
 function ttfmake_jetpack_infinite_scroll_has_footer_widgets()
 {
     // Get the view
     $view = ttfmake_get_view();
     // Get the relevant options
     $hide_footer = (bool) get_theme_mod('layout-' . $view . '-hide-footer', ttfmake_get_default('layout-' . $view . '-hide-footer'));
     $widget_areas = (int) get_theme_mod('footer-widget-areas', ttfmake_get_default('footer-widget-areas'));
     // No widget areas are visible
     if (true === $hide_footer || $widget_areas < 1) {
         return false;
     }
     // Check for active widgets in visible widget areas
     $i = 1;
     while ($i <= $widget_areas) {
         if (is_active_sidebar('footer-' . $i)) {
             return true;
         }
         $i++;
     }
     // Still here? No footer widgets.
     return false;
 }
예제 #4
0
<?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();
?>
예제 #5
0
<?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');
}
예제 #6
0
<?php

/**
 * @package Make
 */
$comment_count_key = 'layout-' . ttfmake_get_view() . '-comment-count';
$comment_count_option = ttfmake_sanitize_choice(get_theme_mod($comment_count_key, ttfmake_get_default($comment_count_key)), $comment_count_key);
?>

<?php 
if ('none' !== $comment_count_option) {
    ?>
	<div class="entry-comment-count">
	<?php 
    if ('icon' === $comment_count_option) {
        ?>
		<a href="<?php 
        comments_link();
        ?>
">
			<?php 
        comments_number('<span class="comment-count-icon zero">0</span>', '<span class="comment-count-icon one">1</span>', '<span class="comment-count-icon many">%</span>');
        ?>
		</a>
	<?php 
    } else {
        ?>
		<a href="<?php 
        comments_link();
        ?>
">
예제 #7
0
파일: extras.php 프로젝트: jalex403/make
 /**
  * Determine if the current view should show a sidebar in the given location.
  *
  * @since  1.0.0.
  *
  * @param  string    $location    The location to test for.
  * @return bool                   Whether or not the location has a sidebar.
  */
 function ttfmake_has_sidebar($location)
 {
     global $wp_registered_sidebars;
     // Validate the sidebar location
     if (!in_array('sidebar-' . $location, array_keys($wp_registered_sidebars))) {
         return false;
     }
     // Get the view
     $view = ttfmake_get_view();
     // Get the relevant option
     $show_sidebar = (bool) get_theme_mod('layout-' . $view . '-sidebar-' . $location, ttfmake_get_default('layout-' . $view . '-sidebar-' . $location));
     // Builder template doesn't support sidebars
     if ('template-builder.php' === get_page_template_slug()) {
         $show_sidebar = false;
     }
     /**
      * Allow developers to dynamically changed the result of the "has sidebar" check.
      *
      * @since 1.2.3.
      *
      * @param bool      $show_sidebar    Whether or not to show the sidebar.
      * @param string    $location        The location of the sidebar being evaluated.
      * @param string    $view            The view name.
      */
     return apply_filters('make_has_sidebar', $show_sidebar, $location, $view);
 }
예제 #8
0
<?php

/**
 * @package Make
 */
$taxonomy_view = ttfmake_get_view();
$category_key = 'layout-' . $taxonomy_view . '-show-categories';
$tag_key = 'layout-' . $taxonomy_view . '-show-tags';
$category_option = (bool) get_theme_mod($category_key, ttfmake_get_default($category_key));
$tag_option = (bool) get_theme_mod($tag_key, ttfmake_get_default($tag_key));
?>

<?php 
if (($category_option || $tag_option) && (has_category() && ttfmake_categorized_blog() || has_tag())) {
    ?>
	<?php 
    $category_list = get_the_category_list();
    $tag_list = get_the_tag_list('<ul class="post-tags"><li>', "</li>\n<li>", '</li></ul>');
    // Replicates category output
    $taxonomy_output = '';
    // Categories
    if ($category_option && $category_list) {
        $taxonomy_output .= __('<i class="fa fa-file"></i> ', 'make') . '%1$s';
    }
    // Tags
    if ($tag_option && $tag_list) {
        $taxonomy_output .= __('<i class="fa fa-tag"></i> ', 'make') . '%2$s';
    }
    // Output
    printf($taxonomy_output, $category_list, $tag_list);
}
예제 #9
0
/**
 * Add the Yoast SEO breadcrumb, if the plugin is activated.
 *
 * @since 1.6.4.
 *
 * @return void
 */
function ttfmake_yoast_seo_breadcrumb()
{
    if (function_exists('yoast_breadcrumb')) {
        $key = 'layout-' . ttfmake_get_view() . '-yoast-breadcrumb';
        $option = absint(get_theme_mod($key, ttfmake_get_default($key)));
        if (1 === $option || is_404()) {
            yoast_breadcrumb('<p class="yoast-seo-breadcrumb">', '</p>');
        }
    }
}
예제 #10
0
파일: entry-date.php 프로젝트: fovoc/make
<?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 CriticaLink
 */
$title_key = 'layout-' . ttfmake_get_view() . '-hide-title';
$title_option = (bool) get_theme_mod($title_key, ttfmake_get_default($title_key));
?>

<?php 
if (get_the_title() && !$title_option) {
    ?>
<h1 class="entry-title">
	<?php 
    the_title();
    ?>
</h1>
<?php 
}
예제 #12
0
<?php

/**
 * @package Make
 */
// Posts and Pages
if (is_singular()) {
    the_content();
    // Blog, Archives, Search Results
} else {
    $content_key = 'layout-' . ttfmake_get_view() . '-auto-excerpt';
    $content_option = (bool) get_theme_mod($content_key, ttfmake_get_default($content_key));
    if ($content_option || has_excerpt()) {
        echo wpautop(get_the_excerpt() . "\n\n" . ttfmake_get_read_more());
    } else {
        the_content(ttfmake_get_read_more('', ''));
    }
}
예제 #13
0
<?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'))) {