Sorry, i was looking at the module file in content_builder instead of wp_booster folder. My bad!
Hi PhilDbz,
It looks like tagDiv changed the td_module.php file because I can’t find the line you are referring to. Does anyone know how to fix this? I’m on version 3.6.
Thanks!
This is a post i published yesterday. The 7 days post count still shows the wrong amount of views. Screenshot: http://i.imgur.com/DH2iEZs.png
-
This reply was modified 12 years by
r1kay.
Radu, i’ve installed both plugins and have them couting views for a week nog. But it still doesn’t work. The 7 days post count still doesnt work with these plugins. The post meta on some old posts that maybe have been viewed 10 times the last week show a 7 days post count of 1200 in the meta. This is impossible. Please provide some support!
Yeah i have 3.9. I’ll wait till they update those plugins and then keep you updated!
Hey Christopher! When I run the script (with api key) locall with wamp server, the response time is almost zero. When executing the code on my server (by putting a clean php code in the root and execute it by requesting the file), there’s a delay. Almost 7 seconds delay. Now, i know you are also running a plesk server, do you know if it could have to do something with my server settings? I already tested it by processing PHP by Apache instead of nginx but that doesn’t make a difference. I’m on PHP version 5.4.23, but maybe i’m missing some php extensions?
-
This reply was modified 12 years by
r1kay.
Well i’ve tested a clean php code (without image) that they provide for php in a single script with and without api key and it returns the correct count immediately. Then i’ve tested that clean code within functions.php (and added the created shortcode in the post template) and it delays. Then i’ve tested the clean php code by adding it directly to loop-single.php (without shortcode) and it also delays. So i think it doesnt have anything to do with the sharedcount api or response time, but with the page rendering. For example, category pages that dont contain this code are loaded instantly. Somehow the post pages rendering slows down.
All tests were done without caching to measure respone time.
Well i use the sharedcount api to count the total shares for me. It´s considered one of the fastest api to do this. Maybe i have configured the function wrong, i´ve tested it without caching and this peace of code make the website render at least 3 seconds later. Maybe you can have a look:
function getTotalShares($atts) {
extract(shortcode_atts(array(
'cache' => '600',
'url' => 0,
'f' => 0,
'bgcolor' => '#7bc6f1',
'bordercolor' => '#000',
'borderwidth' => '0',
'bordertype' => 'solid',
'fontcolor' => '#fff',
'fontsize' => '18',
'fontweight' => 'normal',
'padding' => '1',
'fontfamily' => 'Oswald'
), $atts));
$shareHash = "$cache.$url.$f.$bgcolor.$bordercolor.$borderwidth.$bordertype.$fontcolor.$fontsize.$fontweight.$padding.$fontfamily";
$totalShareRecord = 'totalshares_' . $shareHash;
$cachedposts = get_transient($totalShareRecord);
if ($cachedposts !== false) {
return $cachedposts;
} else {
if (!$url) $url = get_permalink($post->ID);
$json = wp_remote_retrieve_body( wp_remote_get("http://api.sharedcount.com/?url=" . rawurlencode($url) . "&apikey=0928d3131a18a15945e4c74fa1a68cef3c6f2ad8"));
$counts = json_decode($json, true);
$return = $counts['Twitter'] + $counts['Facebook']['total_count'] + $counts['GooglePlusOne'];
if ($f) $return = '<div id="totalshares"><img src="http://mhmag.nl/content/uploads/2014/04/viral-icon-retina-42-x-42.png" width="21" height="21" /><div id="sharecounter">' . $return . '</div><div id="gedeeld">x gedeeld</div></div>';
set_transient($totalShareRecord, $return, $cache);
return $return;
}
}
add_shortcode('totalshares','getTotalShares');
Also, the total share counts are shown right below the post title, so maybe that prevents the page from rendering? I’ve added the shortcode in loop-sigle.php right below the page title and above the category and date meta.
Without this function the website will load very quickley, even without cache, due to the nginx set up.
-
This reply was modified 12 years by
r1kay.
Disabling all plugins isn’t an option. I need most of them to make my website work. I was just wondering if it is something theme related or wordpress related. Maybe the theme is set up to load all external js before rendering the page? And if not, how can i make the page render before those scripts are loaded? Also, the wp-postview and ajax vies count plugins slow down the rendering of the page! Are you guys planning on integrating these ajax views counters in the next update? I would be nice to so the theme functions working flawlessly with caching plugins. I mean, that is what you guys advertise with: the theme’s speed and functionality 🙂
Love to hear some opions from other people and would like to know if somebody else is experiencing the same problem with plugins or functions that make js calls to social media api! I can’t be the only one who uses plugins that show how many times a post is shared on social media.
I’ve read the docs already. It is showing up on the post pages, but it isnt showing up on the blocks modules. Please give support. See for yourself http://mhmag.nl
What do you mean with offset filter? How does that work?
Is it true that if you disable the WP-PostView you will lose all view counts? If yes, than how can you ever update the wordpress core, the theme or plugin? You should always disable all plugins when updating…
Hey Marius,
Take a look at my website: http://mhmag.nl
i dont want to use the facebook comment plugin because it overrides the normal comment section and cant be combined with disqus plugin. so my question is, why doesnt the favicon show up? it only shows on the homepage, but not on category and post pages. how to fix this without removing the code from the header?
How did you fix the favicon problem?
Will this be fixed in a future update? I don’t want to ude the fb plugin, because the custom code is mutch faster and cleaner. Is there a temporarily fix for this?
Hi Marius,
Thank you for the support. Could you take a look at why this code doesn´t work when using a child theme?
Also, where to add the code to show or hide author info?
Hi Marius,
I seem to got the code working, but it only works when i edit the themes blog module. I have a child theme, but when i edit the child themes blog module it doesn’t work. I have copied the blog module file to Newspaper-Child/includes/modules/module_modifier/ but it only works when i edit the file in the normal theme. All other module files i edited in Newspaper-Child/includes/modules/ seem to work fine. How come this file doesn’t work? All other files in my child theme work, so i don’t know if i’m doing anything wrong?
Also, could you tell me where to paste this code to hide the header ad?
Hi Marius,
You i figured out the last word “and” wasnt part of the screencast link so i added the code like you said. But i dont have inline ads, only top and bottom ads so i will test it with those two ads.
How do i use this function to also disable the header ad?
I also tried !get_post_meta($post->ID, ‘hide_ad’) instead of get_field, but that doesnt work neither
Hi Marius,
This solution doesn’t work 🙁 I did just exactly as you said but the content top ad and content bottom ad keep showing up. Any suggestions?
It’s possible to create a function that uses the meta in the custom fields to hide ads per post. I posted this question today in another thread, because i dont know which meta to be used and how to construct the function, but it certainly is possible. I’ll keep you posted when I get an answer!
-
This reply was modified 12 years by
r1kay.
Christopher, we recently had a discussion in my thread about Plesk, server caching, and nginx and you look like a guy who seriously knows what he is talking about 🙂 So i’m going to ask you if you could help me out in this thread about a custom function to hide ads on certain pages. I’m sure you know how to find a solution for my problem 🙂 I would really appreciate your help!
Sorry for going completely offtopic!
-
This reply was modified 12 years by
r1kay.
OKay, i figured out that the unique article system is also filtering the sidebar. This practically makes it impossible to make a latest posts block in the sidebar. Please fix this in the future update!
Nevermind, already found it in loop-simple.php. A little side note from the developers when moving function lines to other files would be appreciated in the future.