-1
{exp:channel:entries site="nxtsports" channel="blog" dynamic="no" limit="5" status="open|Preview" {global:disable_basic} orderby="view_count_one" {!--display_by="week" start_day="Monday"--}}
                {snp_global_blog_article_listed}
                This has been seen {view_count_one} times!                  

            {/exp:channel:entries}

Anyone know how to use the display_by parameters I commented out to display the top 5 entries with the most views from the past 2 weeks?

2

There's a sample of this code on user guide. You need to use the start-on parameter and to enable PHP to run at input on the template:

<?php
        $start_time = ee()->localize->format_date('%Y-%m-%d %H:%i', ee()->localize->now - (60*60*24*14));
?>

{exp:channel:entries start_on="<?php echo $start_time; ?>" site="nxtsports" channel="blog" dynamic="no" limit="5" status="open|Preview" {global:disable_basic} orderby="view_count_one"}
    {snp_global_blog_article_listed}
    This has been seen {view_count_one} times!                  
{/exp:channel:entries}
1
  • 2
    Oh dear, RT*M :( , it's worth noting you should set PHP to run on input so that the PHP date is inserted before the channel tag is parsed. – Blatant Apr 22 '15 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.