Skip to content

Instantly share code, notes, and snippets.

@raank
Created July 6, 2015 15:47
Show Gist options
  • Save raank/1b6601b169c70d128902 to your computer and use it in GitHub Desktop.
Save raank/1b6601b169c70d128902 to your computer and use it in GitHub Desktop.
single.php
<?php
get_header();
wize_set_views(get_the_ID());
$image_id = get_post_thumbnail_id($post->ID);
$cover = wp_get_attachment_image_src($image_id, 'single-full');
$no_cover = get_template_directory_uri();
$cover_full = get_post_meta($post->ID, "post_cover", true) == 'yes';
$gallery = get_post_meta($post->ID, "post_gallery", true) == 'yes';
$review = get_post_meta($post->ID, "post_review", true) == 'yes';
$vimeo = get_post_meta($post->ID, "post_vimeo", true);
$youtube = get_post_meta($post->ID, "post_youtube", true);
$category = get_the_category();
$page_layout = wize_post_sidebar_layout();
if ($youtube || $vimeo) {
echo '
<div id="cover-video">
<div class="cover-video-bg"></div>
<div class="cover-video-wrap">
<div class="cover-video-info">
<span class="cat">' . $category[0]->cat_name . '</span>
<h1> ' . get_the_title($post->ID) . '</h1>
</div><!-- end .cover-video-info -->
<div class="cover-video-dvc">
<span class="date">' . get_the_time('l, d F Y') . '</span>
<span class="view">' . wize_get_views(get_the_ID()) . ' views</span>
</div><!-- end .cover-video-dvc -->
<div class="cover-video">';
if ($youtube) {
echo '
<iframe src="http://www.youtube.com/embed/' . $youtube . '" width="680" height="400" frameborder="0" allowfullscreen></iframe>';
}
if ($vimeo) {
echo '
<iframe src="http://player.vimeo.com/video/' . $vimeo . '" width="680" height="400" frameborder="0" allowFullScreen></iframe>';
}
echo '
</div><!-- end .cover-video -->
</div><!-- end .cover-video-wrap -->
</div><!-- end #cover-video -->';
}
if ($cover_full) {
echo '
<div id="cover-full">
<div class="cover-full-bg"></div>
<div class="cover-full-wrap">
<div class="cover-full-info">
<span class="cat">' . $category[0]->cat_name . '</span>
<h1> ' . get_the_title($post->ID) . '</h1>
</div><!-- end .cover-full-info -->
<div class="cover-full-dvc">
<span class="date">' . get_the_time('l, d F Y') . '</span>
<span class="view"><?php the_author(); ?></span>
<span class="comm">' . get_comments_number() . ' ' . esc_html__( "Comentários", "wizedesign" ) . '</span>
</div><!-- end .cover-full-dvc -->
</div><!-- end .cover-full-wrap -->
</div><!-- end #cover-full -->';
}
echo '
<!-- Wrap -->
<div id="contback">
<div id="wrap" class="fixed">';
switch ($page_layout) {
case "sidebar-left":
echo '
<div id="sng-right">';
break;
case "sidebar-full":
echo '
<div id="blog-full">';
break;
case "sidebar-right":
echo '
<div id="sng-left">';
break;
}
if (have_posts())
while (have_posts()):
the_post();
$image_id = get_post_thumbnail_id($post->ID);
$cover = wp_get_attachment_image_src($image_id, 'SngRewCinW3Feat');
$no_cover = get_template_directory_uri();
$category = get_the_category();
$vimeo = get_post_meta($post->ID, "post_vimeo", true);
$youtube = get_post_meta($post->ID, "post_youtube", true);
$author = get_the_author_meta('ID');
$link = of_get_option('active_link', '1') == '1';
$social = of_get_option('social_sng', '1') == '1';
$tag = of_get_option('tag_sng', '1') == '1';
echo '
<div class="sng-art">
<div class="sng-like">' . wize_like_sng($post->ID) . '</div>';
if (!$cover_full and !$youtube and !$vimeo) {
echo '
<h1 class="sng-title">' . get_the_title() . '</h1>
<div class="sng-info">
<span class="cat">' . $category[0]->cat_name . '</span>
<div class="sng-dvc">
<span class="date">' . get_the_time('l, d F Y') . '</span>
<span class="view">' . wize_get_views(get_the_ID()) . ' ' . esc_html__( "Views", "wizedesign" ) . '</span>
<span class="comm">' . get_comments_number() . ' ' . esc_html__( "Comentários:", "wizedesign" ) . '</span>
</div>
<!-- end .sng-dvc -->
</div><!-- end .sng-info -->
<div class="sng-cover">';
if ($image_id) {
echo '
<img src="' . esc_url($cover[0]) . '" alt="' . esc_attr( get_the_title() ) . '" />';
} else {
echo '
<img src="' . esc_url($no_cover) . '/images/no-cover/sng.png" alt="no-cover" />';
}
echo '
</div><!-- end .sng-cover -->';
}
if ($review) {
require('review.php');
}
echo "<p>" . the_content() . "</p>";
if ($gallery) {
wize_generate_gallery(get_the_ID());
}
echo '
<div class="sng-bottom fixed">';
echo '
' . get_the_tag_list('<div class="sng-tag"><span>' . esc_html__( "tags", "wizedesign" ) . '</span>', ' ', '</div><!-- end .sng-tag -->') . '';
if ($social) {
echo '
<div class="sng-social">
<span>' . esc_html__( "share", "wizedesign" ) . '</span>
<a href="https://www.facebook.com/sharer/sharer.php?u=' . esc_url( get_permalink() ) . '" target="_blank"><div class="sng-facebook"></div></a>
<a href="https://twitter.com/home?status=' . esc_url( get_permalink() ) . '" target="_blank"><div class="sng-twitter"></div></a>
<a href="https://plus.google.com/share?url=' . esc_url( get_permalink() ) . '" target="_blank"><div class="sng-google"></div></a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url=' . esc_url( get_permalink() ) . '" target="_blank"><div class="sng-linkedin"></div></a>
</div><!-- end .sng-social -->';
}
wp_link_pages( array( 'before' => '<div class="page-links">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
if ($link) {
echo '
<div class="sng-links">
<div class="sng-links-prev">' . get_previous_post_link() . '</div>
<div class="sng-links-next">' . get_next_post_link() . '</div>
</div><!-- end .sng-links -->';
}
/// AQUIII
echo '</div><!-- end .sng-bottom fixed -->';
// SEU CÓDIGO
echo do_shortcode('[easy-social-share buttons="facebook" counters=0 style="button" template="big" facebook_text="Gostou? Compartilhe!"]');
// SEU CÓDIGO
echo '</div><!-- end .sng-art -->';
endwhile;
$aut = of_get_option('active_author', '1') == '1';
if ($aut) {
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$post_count = $wpdb->get_var( $wpdb->prepare(
"SELECT COUNT(*)
FROM $wpdb->posts
WHERE post_author = '" . $curauth->ID . "'
AND post_type = 'post'
AND post_status = 'publish'",
$post_author,
$post_type,
$post_status
) );
$userID = get_the_author_meta('ID');
$comment_count = $wpdb->get_var( $wpdb->prepare(
"SELECT COUNT( * )
AS total FROM {$wpdb->comments}
WHERE comment_approved = '1'
AND user_id = '" . $userID . "' ",
$comment_approved,
$user_id
) );
echo '
<div class="sng-aut">
<div class="author-avatar">';
echo get_avatar(get_the_author_meta('ID'));
echo '
</div><!-- end .author-avatar -->
<div class="author-description">
<a href="' . esc_url(get_author_posts_url($author)) . '"><p class="user">' . $curauth->display_name . '</p></a>
<p>' . $curauth->description . '</p>
<p class="info"> ' . $post_count . ' ' . esc_html__( "posts", "wizedesign" ) . ' | ' . $comment_count . ' ' . esc_html__( "Comentários:", "wizedesign" ) . ' <span class="url"><a href="' . esc_url( $curauth->user_url ) . '" target="_blank">' . $curauth->user_url . '</a></span></p>
</div><!-- end .author-description -->
</div><!-- end .sng-aut -->';
}
echo '
' . comments_template('', true) . '
</div><!-- end #sng(left&full&right) -->';
switch ($page_layout) {
case "sidebar-left":
echo '
<div id="sidebar-left">';
wize_set_section('zone-sidebar');
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('single-page'));
echo '
</div><!-- end .sidebar-left -->';
break;
case "sidebar-full":
break;
case "sidebar-right":
echo '
<div id="sidebar-right">';
wize_set_section('zone-sidebar');
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('single-page'));
echo '
<!-- end .sidebar-right -->';
break;
}
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment