Ejemplo n.º 1
0
<?php

/**
 * @package Stag_Customizer
 * @subpackage Ink
 */
// Exit, if current user has no access to the content
if (stag_rcp_user_has_no_access()) {
    return;
}
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) {
    comments_template();
}
 /**
  * Adds custom classes to the array of body classes.
  *
  * @since 1.0.
  *
  * @param array $classes Classes for the body element.
  * @return array
  */
 function stag_post_classes($classes)
 {
     $post_id = get_the_ID();
     if (!is_single() && !is_page()) {
         $classes[] = 'post-grid';
     }
     if (true == apply_filters('stag_showing_related_posts', false)) {
         $classes[] = 'post-grid';
     }
     if (true == apply_filters('stag_loading_more_posts', false)) {
         $classes[] = 'animate';
     }
     if (stag_rcp_user_has_no_access()) {
         $classes[] = 'restricted-post';
     }
     return $classes;
 }
Ejemplo n.º 3
0
 /**
  * Display related posts, based on post tags.
  *
  * @since 1.0.0.
  * @return void
  */
 function stag_related_posts()
 {
     global $post;
     if (stag_rcp_user_has_no_access()) {
         return;
     }
     if (!stag_theme_mod('post_settings', 'show_related_posts')) {
         return;
     }
     $tags = wp_get_post_tags($post->ID);
     if (count($tags)) {
         $tag_ids = array();
         foreach ($tags as $individual_tag) {
             $tag_ids[] = $individual_tag->slug;
         }
         $query = new WP_Query(array('tag' => implode(',', $tag_ids), 'post__not_in' => array($post->ID), 'posts_per_page' => absint(stag_theme_mod('post_settings', 'related_posts_count')), 'ignore_sticky_posts' => true));
         // Add filter to later attach 'post-grid' class to posts for homepage layouts.
         add_filter('stag_showing_related_posts', '__return_true');
         if ($query->have_posts()) {
             echo '<section class="related-posts" data-layout="2-2-2-2">';
             while ($query->have_posts()) {
                 $query->the_post();
                 get_template_part('content', get_post_format());
             }
             echo '</section>';
         }
     }
     wp_reset_query();
     remove_all_filters('stag_showing_related_posts');
 }
/**
 * Template for displaying post specific post cover, background color and images.
 *
 * @package Stag_Customizer
 * @subpackage Ink
 */
$post_id = get_the_ID();
// Get post Categories
$categories_list = get_the_category_list(', ');
// Get Featured Image's caption
$thumb_post = get_post(get_post_thumbnail_id());
$caption = $thumb_post->post_excerpt;
$videos = array('video/mp4' => stag_get_post_meta('settings', $post_id, 'post-video-mp4'), 'video/webm' => stag_get_post_meta('settings', $post_id, 'post-video-webm'), 'video/ogv' => stag_get_post_meta('settings', $post_id, 'post-video-ogv'));
$videos = array_filter($videos);
// Hide videos if the post is restricted or password protected
$restricted_condition = count($videos) && !stag_rcp_user_has_no_access() && !post_password_required();
// Get CSS3 background filter option
$background_filter = stag_get_post_meta('settings', $post_id, 'post-background-filter');
if (!$background_filter) {
    $background_filter = 'none';
}
// Output post cover CSS
stag_post_background_css();
?>

<div class="article-cover article-cover--<?php 
echo esc_attr(get_the_ID());
if ($restricted_condition) {
    echo ' has-video';
}
?>