Add viewcount on my website
-
Hello,
I was wondering if anyone on here could help me put view count on my website pages (streamingmangas.com) just like this website does >> (streaminghd.fr)
I have looked for plugins but nothing, I have no idea how he has done this, I have also seen many other websites with the same view count..
Hope I could find help here..
Image >> https://imgur.com/kH7Ab2nTHANKS ALOT IN ADVANCE !
-
Anyone help ?
Bump..
This tutorial should help you but it does not use a plugin and requires modifications to your functions.php file & your individual theme files. If you know your way around WordPress a little, it should be pretty easy to follow:
https://wpsnipp.com/index.php/functions-php/track-post-views-without-a-plugin-using-post-meta/
Hope it helps
Hello, and thanks for the reply WP Cover I highly appreciate it.
Could you tell me where to add the codes please? This is my functions.php of my wp theme;<?php
function register_my_menus( )
{
register_nav_menus( array( “header-nav” => __( “Keremiya Header Menüsü” ) ) );
}function keremiya_afis_sistemi( $meta )
{
global $post;
if ( get_option( “keremiya_yeni” ) == “On” )
{
$dil = get_post_meta( $post->ID, “”.$meta.””, true );
if ( $dil == “Girilmedi” )
{
echo “”;
}
if ( $dil == “Turkce Dublaj” )
{
echo “<span class=\”tr-dublaj\”></span>”;
}
if ( $dil == “Turkce Altyazi” )
{
echo “<span class=\”tr-altyazi\”></span>”;
}
}
}function keremiya_meta( $isim, $alan, $sonra )
{
global $post;
$ozel = get_post_meta( $post->ID, “”.$alan.””, true );
if ( $ozel != “” )
{
echo “<p><span>”.$isim.”</span>: “.$ozel.”</p>”;
}
else
{
echo “”.$sonra.””;
}
}function keremiya_resim( $uzunluk, $genislik, $hasresim )
{
global $post;
$resim = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), “”.$hasresim.”” );
$resmim = get_post_meta( $post->ID, “resim”, true );
$resim_bul = keremiya_resim_bulucu( );
if ( has_post_thumbnail( ) )
{
echo “<img src=\””.$resim[0].”\” alt=\””.get_the_title( $post->ID ).”\” height=\””.$uzunluk.”\” width=\””.$genislik.”\” />”;
}
else if ( $resmim != “” )
{
echo “<img src=\””.$resmim.”\” alt=\””.get_the_title( $post->ID ).”\” height=\””.$uzunluk.”\” width=\””.$genislik.”\” />”;
}
else
{
echo “<img src=\””.$resim_bul.”\” alt=\””.get_the_title( $post->ID ).”\” height=\””.$uzunluk.”\” width=\””.$genislik.”\” />”;
}
}function toplamfilm( $ilk = “Sitemizde ?uan toplam”, $son = “film bulunmaktad?r.” )
{
$toplam_film = wp_count_posts( “post” );
$toplam_film = $toplam_film->publish;
$b = ” “;
echo “<div class=\”toplamfilm\”>”.$ilk.$b.$toplam_film.$b.$son.”</div>”;
}function keremiya_zaman( $type = “post” )
{
$d = “comment” == $type ? “get_comment_time” : “get_post_time”;
return human_time_diff( $d( “U” ), current_time( “timestamp” ) ).” “.__( “Ago”, “keremiya” );
}function nezaman_yazildi( )
{
$gun = get_the_date( “d” );
$ay = get_the_date( “m” );
$yil = get_the_date( “Y” );
$bugun = date( “d” );
$buay = date( “m” );
$buyil = date( “Y” );
if ( $yil == $buyil )
{
if ( $ay == $buay )
{
if ( $gun == $bugun )
{
echo “Added today”;
}
else
{
$gunonce = $bugun – $gun;
if ( 6 < $gunonce )
{
$haftaonce = round( $gunonce / 7 );
echo $haftaonce.” Added weeks”;
}
else
{
if ( $gunonce == 1 )
{
echo “”;
}
else
{
echo $gunonce.” Added days ago”;
}
}
}
}
else
{
$ayonce = $buay – $ay;
echo $ayonce.” Added months”;
}
}
else
{
$yilonce = $buyil – $yil;
if ( $yilonce < 2 )
{
$ayonce = 12 – $ay + $buay;
echo $ayonce.” Added months”;
}
else
{
echo $yilonce.” added years ago “;
}
}
}function keremiya_resim_bulucu( )
{
global $post;
global $posts;
$first_img = “”;
ob_start( );
ob_end_clean( );
$output = preg_match_all( “/<img.+src=[‘\”]([^’\”]+)[‘\”][^>]*>/i”, $post->post_content, $matches );
$first_img = $matches[1][0];
$adres = get_bloginfo( “template_url” );{
$first_img = “{$adres}/images/no-thumbnail.png”;
}
return $first_img;
}function bilgi_part( $args = “” )
{
global $post;
$bilgi = get_post_meta( $post->ID, “partbilgi”, true );
if ( $bilgi != “” )
{
echo “<span style=\”margin-right:2px;text-transform:none;\”>( “.$bilgi.” )</span>”;
}
else
{
echo “<span style=\”margin-right:2px;text-transform:none;\”>( Yüksek Kalite )</span>”;
}
}function keremiya_part_sistemi( $args = “” )
{
$defaults = array( “before” => “”.__( “”.$bilgi.”” ), “after” => “<span class=\”keros\”>Yorum yap</span>”, “link_before” => “<span>”, “link_after” => “</span>”, “echo” => 1 );
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
global $page;
global $numpages;
global $multipage;
global $more;
global $pagenow;
global $pages;
$bilgi_bir = get_option( “keremiya_part_bir” );
$output = “”;
if ( $multipage )
{
$output .= $before;
$i = 1;
while ( $i < $numpages + 1 )
{
$part_content = $pages[$i – 1];
$has_part_title = strpos( $part_content, “<!–baslik:” );
if ( 0 === $has_part_title )
{
$end = strpos( $part_content, “–>” );
$title = trim( str_replace( “<!–baslik:”, “”, substr( $part_content, 0, $end ) ) );
}
$output .= ” “;
if ( $i != $page || !$more && $page == 1 )
{
$output .= _wp_link_page( $i );
}$output .= $link_before.$title.$link_after;
if ( $i != $page || !$more && $page == 1 )
{
$output .= “”;
}
$i = $i + 1;
}
$output .= $after;
}
if ( $echo )
{
echo $output;
}
return $output;
}function keremiya_comment( $comment, $args, $depth )
{
$GLOBALS[‘comment’] = $comment;
echo ” <li “;
comment_class( );
echo ” id=\”li-comment-“;
comment_id( );
echo “\”>\r\n <div id=\”comment-“;
comment_id( );
echo “\”>\r\n <div class=\”comment-author vcard\”>\r\n “;
echo get_avatar( $comment->comment_author_email, “30”, $default = get_template_directory_uri( ).”/images/gravatar.gif” );
echo “\r\n “;
printf( __( “<cite class=\”fn\”>%s</cite> <span class=\”says\”> – </span>” ), get_comment_author_link( ) );
echo “<s”;
echo “pan class=\”comment-zaman\”>”;
echo keremiya_zaman( “comment” );
echo ” said :</span>\r\n </div>\r\n “;
if ( $comment->comment_approved == “0” )
{
echo ” “;
_e( “Your comment is awaiting moderation.” );
echo “\r\n
\r\n “;
}
echo “\r\n <div class=\”comment-meta commentmetadata\”><a href=\””;
echo esc_url( get_comment_link( $comment->comment_ID ) );
echo “\”>”;
printf( __( “%1\$s” ), get_comment_date( __( “F j, Y” ) ) );
echo ” ‘.”;
edit_comment_link( __( “(Edit)” ), ” “, “” );
echo “</div>\r\n\r\n “;
comment_text( );
echo ” </div>\r\n”;
}function keremiya_facebook( )
{
global $post;
$fb_resim = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), “single-resim” );
$fb_resmim = get_post_meta( $post->ID, “resim”, true );
if ( is_single( ) )
{
if ( has_post_thumbnail( ) )
{
echo “<meta property=\”og:image\” content=\””.$fb_resim[0].”\” />”;
}
else if ( $fb_resmim != “” )
{
echo “<meta property=\”og:image\” content=\””.$fb_resmim.”\” />”;
}
else
{
echo “<meta property=\”og:image\” content=\””.keremiya_resim_bulucu( ).”\” />”;
}
echo “\r\n<meta property=\”og:title\” content=\””;
wp_title( “|”, true, “right” );
bloginfo( “name” );
echo “\” />\r\n<meta property=\”og:site_name\” content=\””;
bloginfo( “name” );
echo “\” />\r\n<meta property=\”og:url\” content=\””;
the_permalink( );
echo “\” />\r\n”;
}
}include_once( “framework/keremiya.php” );
include_once( “framework/tema-dili.php” );
include_once( “framework/likethis.php” );
include_once( “framework/tema-kurulumu.php” );
include_once( “framework/keremiya-yenilikleri.php” );
include_once( “framework/widgets/keremiya-film-kutusu.php” );
include_once( “framework/widgets/keremiya-kategoriler.php” );
include_once( “framework/widgets/facebook-like-widget.php” );
add_filter( “show_admin_bar”, “__return_false” );
remove_action( “personal_options”, “_admin_bar_preferences” );
remove_action( “wp_head”, “rel_canonical” );
global $wp_rewrite;
$wp_rewrite->author_base = “profil”;
add_theme_support( “post-thumbnails”, array( “post” ) );
add_image_size( “anasayfa-resim”, 119, 125, true );
add_image_size( “single-resim”, 125, 160, true );
add_image_size( “izlenen-resim”, 70, 80, true );
add_image_size( “slide-resim”, 110, 138, true );
add_action( “init”, “register_my_menus” );
register_sidebar( array( “name” => “Sidebar”, “id” => “sidebar”, “before_widget” => “<div class=\”sidebarborder\”><div class=\”sidebar-right\”>”, “after_widget” => “</div></div>”, “before_title” => “<h2>”, “after_title” => “</h2>” ) );
register_sidebar( array( “name” => “Sidebar (Home Movie Section)”, “id” => “anasayfa”, “before_widget” => “<div class=\”filmborder\”><div class=\”filmcontent\”>”, “after_widget” => “</div></div>”, “before_title” => “<div class=\”yazitip\”>”, “after_title” => “</div>” ) );
register_sidebar( array( “name” => “Sidebar (Kategori)”, “id” => “kategori”, “before_widget” => “<div class=\”sidebarborder\”><div class=\”sidebar-right\”>”, “after_widget” => “</div></div>”, “before_title” => “<h2>”, “after_title” => “</h2>” ) );?>
Thanks alot alot !!
Hello,
That tutorial explains it better than I ever could in a WordPress Support forum post. If you are having difficulties following it, I would recommend looking for another alternative or hiring a developer to complete this for you.Alright thanks anyways..
- The topic ‘Add viewcount on my website’ is closed to new replies.