We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21156
    • 6 Posts
    hello, I’m trying to change Ditto snippet and to show article "published on" date and not "created on" date.

    I changed the code in Ditto snippet:

    */
    $dateSource = isset($dateSource) ? $dateSource : "pub_date";
    /*

    But in my webpage it is still displaying the "created on" date. The date is called out with the chunk:

    <div class="ditto_summaryPost">
    <h2>[+title+]</h2>
    <div class="ditto_info" >[+date+] </div>

    [+summary+]
    <p class="ditto_link">
    <a href="[+url+]">daugiau...</a>


    Can someone help me with this one? Is their any other place where I have to change "createdon" with the "pub_date"?

    Thanks in advance.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Using the &dateSource parameter doesn’t work? You shouldn’t need to modify the Ditto code itself.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21156
        • 6 Posts
        I changed the code in Ditto snippet:

        It was:

        */
        $dateSource = isset($dateSource) ? $dateSource : "createdon";
        /*

        And now it is:

        */
        $dateSource = isset($dateSource) ? $dateSource : "pub_date";
        /*

        But the result in my web page is the same - it is showing the creation date...

        Modxcms is really tricky for me, don’t know what else to do : (
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          You should be able to leave the Ditto code alone, and in your Ditto snippet call put:

          [[Ditto? ... &dateSource=`pub_date` ... ]]

          http://ditto.modxcms.com/files/snippet-ditto-php.html#dateSource
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 21156
            • 6 Posts
            Ok, understood (at last) : )

            now it works, thank you.