• Resolved PV-Patrick

    (@pv-patrick)


    I was wondering how you can use multiple API calls with the_loop. I am looping through multiple posts and displaying them in a grid on 1 page. However, the API call never seems to reset for each article and it only displays data for 1 and the rest are empty/0. I have been searching for a solution but haven’t found anything yet and was wondering if anyone had any information, thank you!

    <? posts loop ?>
    wp_slimstat_db::init(‘content_type equals posts|resource contains ‘.$post->post_name);
    $views = wp_slimstat_db::count_records(‘1=1’, ‘ip’, true);
    <? endloop ?>

    http://ww.wp.xz.cn/plugins/wp-slimstat/

Viewing 12 replies - 16 through 27 (of 27 total)
  • Thread Starter PV-Patrick

    (@pv-patrick)

    Definitely, is vote different than a review?

    Plugin Contributor Jason Crouse

    (@coolmann)

    No, it’s the same thing indeed πŸ˜‰

    Thread Starter PV-Patrick

    (@pv-patrick)

    Hi camu,
    When I upgraded slimstat recently, the following line you gave me is breaking the page load:

    wp_slimstat_db::$filters = array();

    If I comment it out, the page loads fine but obviously the view count is off. Running 3.5.4 and it happened when updating to the 3.5 branch I believe. Any suggestions? Thank you!

    Plugin Contributor Jason Crouse

    (@coolmann)

    Things will be fixed in 3.5.5, and you can then comment or remove the workaround…

    Thread Starter PV-Patrick

    (@pv-patrick)

    Thanks camu!

    Any timeframe on 3.5.5? Just asking since it breaks my site or it doesn’t show page views, haha.

    Plugin Contributor Jason Crouse

    (@coolmann)

    Monday night, UTC-5. Or contact us to get it in advance:

    http://support.getused.to.it/

    Camu

    Thread Starter PV-Patrick

    (@pv-patrick)

    Hi Camu – sorry to bug ya again but I updated to 3.5.5 and still no dice. Whether I have wp_slimstat_db::$filters = array(); or not, still doesn’t show the page views.

    Plugin Contributor Jason Crouse

    (@coolmann)

    Could you let us take a look?

    http://support.getused.to.it/

    Thread Starter PV-Patrick

    (@pv-patrick)

    Sure, what is it you need? Here is the code in question:

    wp_slimstat_db::$filters = array();
    wp_slimstat_db::init('content_type equals cpt:vines|resource contains '.$post->post_name);
    $views = wp_slimstat_db::count_records('1=1', '*', true, false);

    If the filters = array() is commented out the page loads but views are all 0. If it’s not commented out, page doesn’t load that section.

    Plugin Contributor Jason Crouse

    (@coolmann)

    Oh I see. There was a note in the changelog: the separator changed from | to &&& (three ampersand chars). See if that helps πŸ˜‰

    Thread Starter PV-Patrick

    (@pv-patrick)

    You’re the man!! That did the trick!

    Curious, why the… weird change?

    Plugin Contributor Jason Crouse

    (@coolmann)

    The pipe char, | , can now be used with the matches operator:

    browser matches firefox|chrome

    In order to do this, we had to use a different separator to avoid the ambiguity πŸ˜‰

    browser matches firefox|chrome&&&year equals last year

Viewing 12 replies - 16 through 27 (of 27 total)

The topic ‘API calls in the_loop’ is closed to new replies.