Glisse
Forum Replies Created
-
Forum: Plugins
In reply to: [Jigoshop] Tracking ecommerce in piwikupdate:
the exact code on jighoshop single-product.php<?php do_action('jigoshop_sidebar'); ?> <?php get_footer('shop'); ?> <?php $plm=jigoshop_cart::get_cart_contents_total_excluding_tax(); if ($plm > 0){ ?><script type="text/javascript"> _paq.push(['trackEcommerceCartUpdate', <?php echo jigoshop_cart::get_cart_contents_total_excluding_tax(); ?> ]); _paq.push(['trackPageView']);</script> <?php }
Forum: Plugins
In reply to: [Jetpack Post Views] Post views not updatingI found out a great resource.. it is a bug in wordpress stats cache, when pooling days -1 the cache never refreshes, it is not plugin`s fault
..
$random = rand( 9999, 9999999 ); // hack to break cache$args = array(
‘days’ => $random,
‘post_id’ => $postID,
);by randomizing the days it is working correctly..
i disabled the plugin and inserted this function in my theme functins php
add_action( ‘template_redirect’, ‘ac_save_views’ );
function ac_save_views() {
global $post; // $post = get_queried_object();
$postID = $post->ID;
$transName = ‘views_throttle_’ . $postID;
$delay = 1; // how many hours to wait before saving views againif ( function_exists( ‘stats_get_csv’ ) && is_singular() && !get_transient( $transName ) && !wp_is_post_revision( $postID ) ) {
$random = rand( 9999, 9999999 ); // hack to break cache
$args = array(
‘days’ => $random,
‘post_id’ => $postID,
);$stats = stats_get_csv( ‘postviews’, $args );
$views = (int) $stats[‘0’][‘views’];$oldviews = get_post_meta( $postID, ‘views’, true );
if ( $views > $oldviews )
update_post_meta( $postID, ‘views’, $views );set_transient( $transName, 1, 60 * 60 * $delay );
}
}
echo the output in single.php with
<?php echo get_post_meta( $post->ID, ‘views’, true );?>Forum: Plugins
In reply to: [Jetpack Post Views] Post views not updatinghaving the same problem, post views are not updating, installed the cron plugins and running the jetpack cron does nothing.. the widget on the other hand is showing correct values..how can i get the code from the widget and put it in single.php? ??
Forum: Fixing WordPress
In reply to: Code to display the latest post publication time in "time ago"Thank you so much for your reply.. at first i could not use your code at all, because my host has php 5.2 installed which does not know date_diff function.. but I installed php 5.3 on the local host, but the output was “latest post ago”, i guess the $post->post_date was the probelm ..
but working upon your code i manged to get a working one in the end
$post= get_lastpostdate('blog'); $convertunix= strtotime($post); $now = date_i18n('U'); $diff = human_time_diff($convertunix, $now); echo "<p>latest post $diff ago</p>";
thanks for your help again !
Forum: Fixing WordPress
In reply to: Link front-page full-size images to their post urlthanks for the reply..did not manage to make it work so far (string errors, brakes the site when c/p the above code) but it is a start…
I also found the following code
/** * Add post permalink to image post format */ function tab13_image_permalink($content){ $format = get_post_format(); $searchfor = '/(<img[^>]*\/>)/'; $replacewith = '<a href="'.get_permalink().'">$1</a>'; if (is_single() === FALSE AND $format == 'image'){ $content = preg_replace($searchfor, $replacewith, $content, 1); } return $content; } add_filter('the_content', 'tab13_image_permalink');
this function is said to make the images on homepage to link to the post url, but so far also it is not working for me.. not even for the default theme.. well, in the end it will work, somehow, although i am not a php literate ??
actually in my case the title are rewritten, but for some reason it adds the blog_title in front of post_title..
so, my blog name is “blabla“, my post title name is “wawa“, and the output for $post_title$ is “blabla | wawa” when it should have been just “wawa“.. the other taqs are working fine