Remove Post View Count at the end of the Content - javascript

I have a 4.3 wordpress system that i install on it the "Orca Theme".
I notice i have duplicate indication of Post View Count:
I want to remove the First Indicator.
I try to look around amd search in the theme code and didnt find what display the First indicator.
postformat/standart.php:
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id, 'postlist', true);
$title_meta = get_post_meta($post->ID, 'title_style', true);
$title_meta = ($title_meta == ('banner' || 'title')) ? $title_meta : "standard";
$category = get_the_category();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> class="post standard">
<?php if($title_meta == "banner"){ ?>
<a class="basicfeature" href="<?php esc_url(the_permalink()); ?>" style="background-image:url('<?php echo esc_url($thumb_url[0]); ?>');"></a>
<h1><?php the_title(); ?></h1>
<?php }elseif($title_meta == "feature"){ ?>
<a href="<?php esc_url(the_permalink()); ?>" class="largeimage postfeature" style="background-image:url('<?php echo esc_url($thumb_url[0]); ?>');">
<div class="shadow"></div>
<h1><?php the_title(); ?></h1>
</a>
<?php }else{ ?>
<h1><?php the_title(); ?></h1>
<?php } ?>
<div class="info">
<div class="left">
<i class="issticky fa fa-thumb-tack "></i><img src="http://0.gravatar.com/avatar/<?php echo esc_attr(md5(get_the_author_meta('user_email'))); ?>?s=32" alt="author" class="minigravatar"><?php the_author(); ?>
</div>
<div class="right">
<i class="fa fa-clock-o"></i><?php echo esc_html(orca_get_time()); ?>
<div class="category"><i class="fa fa-tags"></i>
<?php if($category){
echo '' . $category[0]->name.' ';
} ?>
</div>
</div>
</div>
<div class="postcontents">
<?php the_content('', FALSE, ''); ?>
</div>
<div class="footer">
<?php esc_html_e('Read More', 'orcawp'); ?>
<i class="fa fa-comments"></i><?php echo esc_html(get_comments_number($post->id)); ?>
<?php if(get_post_meta($post->ID, '_count-views_all', true) != ''){ ?>
<i class="fa fa-bullseye"></i><?php echo esc_html(get_post_meta($post->ID, '_count-views_all', true)); ?>
<?php } ?>
</div>

Solve it!
I just Deactivated the "BAW Post Views Count" plugin and now it removed!

Related

Php code My image is no showing on website

my uploaded image are not showing on webpage.
<div class="col-md-8 news-item">
<a href="<?php echo base_url('home/newsdetail/'); ?><?php echo $newsdetail[0]['id']; ?>" style="text-decoration: none; color:black;" >
<h1><?php echo $newsdetail[0]['heading']; ?></h1>
</a>
<p class="author-name"><?php echo $newsdetail[0]['staffname']; ?> <span class="time"><i class="fa fa-clock-o"></i><?php echo date("d-m-Y H:i:s",strtotime($newsdetail[0]['created_date'])); ?></span></p>
<div class="read-img">
<?php if($newsdetail[0]['image']==''){ ?>
<img class="img-responsive" src="<?php echo base_url('assets/img/noimage.gif')?>" height="70"/>
<?php } else { ?>
<?php $multiimage=explode(",",$newsdetail[0]['image']); ?>
<div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:480px;overflow:hidden;visibility:hidden;">
<!-- Loading Screen -->
<div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
<img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="//jssorcdn7.azureedge.net/theme/svg/loading/static-svg/spin.svg" />
</div>
<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:380px;overflow:hidden;">
<?php foreach($multiimage as $imgrow){ ?>
<div>
<img data-u="image" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
<img data-u="thumb" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
</div>
<?php } ?>
</div>
First, try to print image path array. see if those are correct.
<?php
$multiimage=explode(",",$newsdetail[0]['image']);
print_r($multiimage);
?>
Then make sure those images are in the right directory.
Also for debugging purpos try printing the path if it's ok. you can check the image by simply putting the path on a browser URL.
<?php echo base_url('uploads/newsimages/').$imgrow ?>

How to hide classes with PHP/Javascript if/else conditional at wordpress?

I have some problems with conditional (if/else) at Wordpress function.
I need to hide this <span class="xs-item-count highlight xscart"><?php echo esc_html($xs_product_count); ?></span> if the value $xs_product_count is 0 on a cart.
What should I do?
I've tried using PHP Native, but My Website has an error.
My belonging code is:
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class ="mobile-cart-notif offset-cart-menu">
<span class="xs-item-count highlight xscart">
<?php echo esc_html($xs_product_count); ?>
</span>
<i class="icon icon-bag"></i>
</a>
I would try this:
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="mobile-cart-notif offset-cart-menu">
<?php if ((int) $xs_product_count > 0) : ?>
<span class="xs-item-count highlight xscart">
<?php echo esc_html($xs_product_count); ?>
</span>
<?php endif; ?>
<i class="icon icon-bag"></i>
</a>
Putting the (int) in front of the $xs_product_count in the if statement is called "casting" a variable to a type, and it'll change the string of '0' to integer 0 which lets us reliably compare with the > operator.
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class ="mobile-cart-notif offset-cart-menu">
<?php if (0 < $xs_product_count) {?>
<span class="xs-item-count highlight xscart">
<?php echo esc_html($xs_product_count); ?>
</span>
<?php } ?>
<i class="icon icon-bag"></i>
</a>
You can use below condition before span tag.
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class ="mobile-cart-notif offset-cart-menu">
<?php
if($xs_product_count != 0 ){
?>
<span class="xs-item-count highlight xscart">
<?php echo esc_html($xs_product_count); ?>
</span>
<?php } ?>
<i class="icon icon-bag"></i>
</a>
Or you can hide complete section by below code.
<?php
if($xs_product_count != 0 ){
?>
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class ="mobile-cart-notif offset-cart-menu">
<span class="xs-item-count highlight xscart">
<?php echo esc_html($xs_product_count); ?>
</span>
<i class="icon icon-bag"></i>
</a>
<?php } ?>

why pagination in my wordpress theme is not showing (wp-paginate plugin)

I use the rethink theme in wordpress, and use the wp-paginate plugin
in arcive.php, category.php and index.php pagination is fine
but why in page.php not running?
and I created my own template showing all the posts
posting.php
<?php
/*
Template Name: posting
*/
get_header();
?>
<div class="full-content">
<div class="grid_17 alpha">
<div class="content_bar">
<div class="feature_content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
$myposts = get_posts(array('posts_per_page'=>3)); ;
foreach($myposts as $post) :
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('product'); ?>>
<div class="post-info">
<h1 class="product_title">
<a href= "<?php the_permalink(); ?>" rel="bookmark" title="<?php echo sprintf(__("Permanent link to %s", 'rethink'), get_the_title(get_the_ID())); ?>">
<?php the_title(); ?>
</a>
</h1>
<div class="detail">
<ul class="post_meta">
<li class="admin"><?php printf(__("Posted by %s", 'rethink'), get_the_author_link()); ?></li>
<li class="date"><?php printf(__('Posted on %s', 'rethink'), get_the_time('F j, Y')); ?></li>
<li class="category"><?php the_category(','); ?></li>
<li class="commentt"><?php comments_popup_link(__('No Comments.', 'rethink'), __('1 Comment.', 'rethink'), __('% Comments.', 'rethink')); ?></li>
</ul>
</div>
</div>
<div class="post_thumbnail_wrapper">
<?php if (has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('post_thumbnail', array('class' => 'postimg')); ?>
</a>
<?php
} else {
echo rethink_main_image();
}
?>
</div>
<div class="product_content"><?php the_excerpt(); ?><div class="buttons"><a class="btn-2" href="<?php the_permalink() ?>"><span><?php _e('Read Review', 'rethink') ?></span></a></div>
</div>
</div>
<?php endforeach;
if(function_exists('wp_paginate')){
wp_paginate(); }
wp_reset_postdata(); ?>
<div class="clear"></div>
<?php endwhile;
else:
?>
<div class="product">
<p>
<?php _e('Sorry, no posts matched your criteria.', 'rethink'); ?>
</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="grid_7 omega">
<!--Start Sidebar-->
<?php get_sidebar(); ?>
<!--End Sidebar-->
</div>
</div>
<?php get_footer(); ?>
how i want to display the pagination of my coding ????
sorry if the line of code is not neat I still newbie
Update this Code:
if(function_exists('wp_paginate')){
wp_paginate();
}
to this code:
if(function_exists('wp_paginate')){
wp_paginate(array('page' => 'page'));
}

Only show slider if one or more related items exist

I have a portfolio on a WordPress theme and on the single portfolio page it has a slider of related portfolio items. Well it's a cool feature but it shows the slider even if no related items match that particular portfolio item.
Here is my template where I display the slider:
<div class="related_portfolio">
<?php gbx_related_portfolio($post->ID); ?>
</div>
Here are my functions I am using to create my slider:
function get_related_portfolio($post_id) {
$item_cats = get_the_terms($post_id, 'portfolio_category');
if ($item_cats) {
foreach ($item_cats as $item_cat) $item_array[] = $item_cat->term_id;
}
$args = wp_parse_args($args, array(
'showposts' => 5,
'post__not_in' => array($post_id),
'ignore_sticky_posts' => 0,
'post_type' => 'portfolio',
'tax_query' => array(
array(
'taxonomy' => 'portfolio_category',
'field' => 'id',
'terms' => $item_array
)
),
'orderby' => 'rand'
));
$query = new WP_Query($args);
return $query;
}
AND
function gbx_related_portfolio($post_id) {
?>
<div class="recentportfolio-wrapper">
<div class="image-carousel-header">
<div class="image-carousel-title"><span>Related Items</span></div>
<div class="image-carousel-nav">
<a class="prev"><i class="fa fa-chevron-left"></i></a><a class="next"><i class="fa fa-chevron-right"></i></a>
</div>
<div class="clear"></div>
</div>
<div class="iosslider recentportfolio-carousel <?php echo 'recentportfolio-carousel'.$randomid; ?>">
<ul><?php
$recentPortfolio = get_related_portfolio($post_id);
if ($recentPortfolio->have_posts()) {
while ( $recentPortfolio->have_posts() ) { $recentPortfolio->the_post(); global $post; ?>
<li class="portfolioslider_item">
<div class="portfolio-item">
<div class="image">
<a href="<?php the_permalink(); ?>">
<?php
if('' != get_the_post_thumbnail())
$full_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
else
$full_image = get_template_directory_uri().'/images/thumbnail_placeholder.png';
echo '<img class="size-full" src="' . gbx_process_image($full_image, 270, 240).'" alt="'.get_the_title(get_post_thumbnail_id($post->ID)).'"/>';
?>
</a>
<div class="image-extras">
<div class="image-extras-bg"></div>
<div class="image-extras-content">
<a class="icon" href="<?php the_permalink(); ?>"><span class="glyphicon glyphicon-paperclip"></span></a>
<a class="icon swipebox" href="<?php echo $full_image; ?>" title="<?php echo get_the_title($post->ID); ?>"><span class="glyphicon glyphicon-search"></span></a>
</div>
</div>
</div>
<div class="portfolio-meta">
<div class="post-title"><?php the_title(); ?></div>
<div class="pull-left"><span class="glyphicon glyphicon-time"></span><?php echo get_the_date('F j, Y'); ?></div>
<div class="pull-right">
<span class="likeanimation"></span>
<a href="#" class="like <?php echo gbx_get_like_status($post->ID); ?>" title="<?php echo gbx_get_like_title($post->ID); ?>" data_action="likepost" data_postid="<?php echo $post->ID; ?>" data_nonce="<?php echo wp_create_nonce("gbx_like_nonce"); ?>">
<span class="glyphicon glyphicon-heart"></span>
<span class="likecount"><?php echo gbx_get_likecount($post->ID); ?></span>
</a>
<span class="glyphicon glyphicon-eye-open"></span><?php echo gbx_get_viewcount($post->ID); ?>
</div>
<div class="clear"></div>
</div>
</div>
</li>
<?php } } ?>
</ul>
</div>
</div>
<script>
(function($){
$(window).load(function() {
var $recentportfolio_carousel = $('.<?php echo 'recentportfolio-carousel'.$randomid; ?>');
function custom_recent_portfolio_UpdateSliderHeight(args) {
var height = $('.<?php echo 'recentportfolio-carousel'.$randomid; ?> .portfolioslider_item:eq(' + (args.currentSlideNumber-1) + ')').outerHeight(true);
$recentportfolio_carousel.css({ height: height });
}
$recentportfolio_carousel.iosSlider({
snapToChildren: true,
desktopClickDrag: true,
navPrevSelector: $recentportfolio_carousel.parent().find('a.prev'),
navNextSelector: $recentportfolio_carousel.parent().find('a.next'),
onSliderLoaded: custom_recent_portfolio_UpdateSliderHeight,
onSlideChange: custom_recent_portfolio_UpdateSliderHeight,
onSliderResize: custom_recent_portfolio_UpdateSliderHeight
});
});
})(jQuery);
</script>
<?php
}
Your code is quite mingled with a lot of syntax errors. I have put all your code in one function and rearrange it and fixed the errors. I'm not 100% sure about this part though, it is untested
function gbx_related_portfolio() {
wp_reset_postdata();
global $post;
$orig_post = $post;
if ( 'portfolio' == get_post_type() ) {
$tags = wp_get_post_terms($post->ID, 'portfolio_category');
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tax_query' => array(
array(
'taxonomy' => 'portfolio_category',
'terms' => $tag_ids,
'operator' => 'IN'
)
),
'post__not_in' => array( $post->ID ),
'posts_per_page' => 5,
'ignore_sticky_posts' => 0
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) { ?>
<div class="recentportfolio-wrapper">
<div class="image-carousel-header">
<div class="image-carousel-title"><span>Related Items</span></div>
<div class="image-carousel-nav">
<a class="prev"><i class="fa fa-chevron-left"></i></a><a class="next"><i class="fa fa-chevron-right"></i></a>
</div>
<div class="clear"></div>
</div>
<div class="iosslider recentportfolio-carousel <?php echo 'recentportfolio-carousel'.$randomid; ?>">
<ul>
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li class="portfolioslider_item">
<div class="portfolio-item">
<div class="image">
<a href="<?php the_permalink(); ?>">
<?php
if('' != get_the_post_thumbnail())
$full_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
else
$full_image = get_template_directory_uri().'/images/thumbnail_placeholder.png';
?>
</a>
<div class="image-extras">
<div class="image-extras-bg"></div>
<div class="image-extras-content">
<a class="icon" href="<?php the_permalink(); ?>"><span class="glyphicon glyphicon-paperclip"></span></a>
<a class="icon swipebox" href="<?php echo $full_image; ?>" title="<?php echo get_the_title($post->ID); ?>"><span class="glyphicon glyphicon-search"></span></a>
</div>
</div>
</div>
<div class="portfolio-meta">
<div class="post-title"><?php the_title(); ?></div>
<div class="pull-left"><span class="glyphicon glyphicon-time"></span><?php echo get_the_date('F j, Y'); ?></div>
<div class="pull-right">
<span class="likeanimation"></span>
<a href="#" class="like <?php echo gbx_get_like_status($post->ID); ?>" title="<?php echo gbx_get_like_title($post->ID); ?>" data_action="likepost" data_postid="<?php echo $post->ID; ?>" data_nonce="<?php echo wp_create_nonce("gbx_like_nonce"); ?>">
<span class="glyphicon glyphicon-heart"></span>
<span class="likecount"><?php echo gbx_get_likecount($post->ID); ?></span>
</a>
<span class="glyphicon glyphicon-eye-open"></span><?php echo gbx_get_viewcount($post->ID); ?>
</div>
<div class="clear"></div>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
<script>
(function($){
$(window).load(function() {
var $recentportfolio_carousel = $('.<?php echo 'recentportfolio-carousel'.$randomid; ?>');
function custom_recent_portfolio_UpdateSliderHeight(args) {
var height = $('.<?php echo 'recentportfolio-carousel'.$randomid; ?> .portfolioslider_item:eq(' + (args.currentSlideNumber-1) + ')').outerHeight(true);
$recentportfolio_carousel.css({ height: height });
}
$recentportfolio_carousel.iosSlider({
snapToChildren: true,
desktopClickDrag: true,
navPrevSelector: $recentportfolio_carousel.parent().find('a.prev'),
navNextSelector: $recentportfolio_carousel.parent().find('a.next'),
onSliderLoaded: custom_recent_portfolio_UpdateSliderHeight,
onSlideChange: custom_recent_portfolio_UpdateSliderHeight,
onSliderResize: custom_recent_portfolio_UpdateSliderHeight
});
});
})(jQuery);
</script>
<?php
}
}
}
$post = $orig_post;
wp_reset_query();
}
Just call it as follows
<div class="related_portfolio">
<?php gbx_related_portfolio(); ?>
</div>

opencart jcarousel on latest product

Right now I'm learning Opencart, and I'm trying to make my latest product display with jCarousel. I'm using Opencart 1.5.4.
This is what I've already tried, but still failed: http://www.packtpub.com/article/opencart-themes-using-jCarousel-plugin
I'm editing the latest.tpl file step-by-step as in the tutorial, but I'm getting stuck on the eight step.
When I open Firefox and hit refresh nothing happens, no error or message. This is my latest.tpl file:
<script type="text/javascript" src="catalog/view/javascript/jquery/jCarousel/js/jquery.jcarousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#latestcarousel').jcarouseljcarousel();
});
</script>
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div id="latestcarousel" class="box-product">
<?php foreach ($products as $product) { ?>
<div class="jCarousel-skin-tango">
<?php if ($product['thumb']) { ?>
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></div>
<?php } ?>
<div class="name"><?php echo $product['name']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div>
</div>
<?php } ?>
</div>
</div>
</div>
Any suggestion?
This is what I do with latest.tpl file. It works now.
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#latestcarousel').jcarousel({
scroll: 1,
visible: 3,
auto: 3,
rtl: true,
wrap: 'circular'
});
});
</script>
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div class="box-product">
<ul id="latestcarousel" class="jcarousel-skin-tango">
<?php foreach ($products as $product) { ?>
<li class="carousel-latest">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></div>
<div class="name"><?php echo $product['name']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
Thanks for anything.

Categories