We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15320
    • 22 Posts
    It seems like the blog is sorting the posts according to the creation date - and not the publication date as is convention in other blog CMS’. But what if I wish to sort the post listing differently? Can I change the creation date somewhere somehow?

    Here is the site:
    http://lifein.web08.fab-it.dk/index.php?id=2

    Thanks a lot!
      • 36592
      • 970 Posts
      Check the ’&sortBy’ option of Ditto snippet.
        • 15320
        • 22 Posts
        It says:
        $sortBy = isset($sortBy) ? $ditto->parseSort($sortBy, $randomize) : "createdon";
        I have changed the "createdon" to "pub_date" and it sorts fine now, but it still displays the created date and not the publication date in the listing. How do I changes this?
        Sorry for asking such basic questions, but are newbie to ModX and still not much into the documentation.
        Thanks!
          • 6726
          • 7,075 Posts
          First, don’t edit parameter this way (e.g directly in the snippet code), you’ll end up having to change them again upon snippet upgrades wink

          In your case simply change the snippet call :

          [tt]&sortBy=`createdon`[/tt]

          to

          [tt]&sortBy=`pub_date`[/tt]

          It’s normal that it only changed the way the list is sorted.

          To change the date used in Ditto templates, you have to use the parameter [tt]&dateSource=`pub_date`[/tt], because it defaults to createdon. This will control which date is used for the [+date+] placeholder in your Ditto template (you can create a custom Ditto template by using the &tpl parameter to specify a chunk to use to that purpose. Check ditto’s documentation to see which placeholders are available.)

          On the detail page for the article, you’ll need to edit your template and change [*createdon*] for [*pub_date*] too.

          Remember that you can format the date easily :

          In your snippet call add :

          [tt]&dateFormat=`%d/%m/%Y` &extenders=`dateFilter`[/tt]

          In your detail page use the following syntax :

          [tt][*createdon:date=`%d.%m.%Y`*][/tt]

          or in your case

          [tt][*pub_date:date=`%d.%m.%Y`*][/tt]
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id