We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22770
    • 285 Posts
    For some reason, I can’t get my wordpress-style archives to work with Ditto/Reflect. I’ve followed the instructions on ditto.modxcms.com as closely as I can, but it’s not working. Here are the calls and template I’m using:

    The Reflect call:
    [!Reflect?config=`wordpress` &targetID=`21` &getDocuments=`1` &dittoSnippetParameters=`parents:15` &id=`wp`!]
    

    15 is the container all my news items are in. 21 is the document for the archives.

    In document 21, I have the following, including the ditto call:

    <h3>[+wp_month+] [+wp_year+]</h3>
    <ul>[!Ditto? &id=`wp` &extenders=`dateFilter` &parents=`15` &tpl=`newsArchiveTemplate` &dateFormat=`%d %B %Y`  &filter=`id,21,2|id,37,2`!]</ul>
    

    I’m filtering out document 37 because it’s my rss feed.

    The chunk newsArchiveTemplate is simply:

    <li><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a> - <em>[+date+]</em></li>


    I’m having two main problems with this.

    Firstly, I have one news item in May and three in July. But whichever month, either May or July, I click on, I always get the three news items in July listed and never the one from May.

    Secondly, the [+wp_month+] [+wp_year+] don’t seem to be displaying the month and year.

    So, any idea what I’m doing wrong?

    One other thing, is it possible to filter out any documents from the Reflect call? The document 37 (created in August) is making reflect show an archive for August, even though there are no news items in August.
      • 18397
      • 3,250 Posts
      Try adding &display=`all` to the Ditto call and see what happens.
        • 22770
        • 285 Posts
        If only! smiley

        Sadly, now it simply displays all archive news items for all months, no matter which month you’ve clicked on. I must be doing something wrong. The month and year are showing in the URL:

        /news/news-archives.html?wp_month=5&wp_year=2007&wp_day=false&wp_start=0&wp_year=2007&wp_day=false&wp_start=0


        But it doesn’t seem to be picking them up.
          • 18397
          • 3,250 Posts
          Do you have xHTML URL’s turned on in the manager configuration? If so, try turning it off, or upgrading to the latest Ditto development version.
            • 22770
            • 285 Posts
            Good call, Mark! That was what was causing it.

            So, do I take it that the next version of Ditto will cope with xHMTL URLs?
              • 22770
              • 285 Posts
              Although I’m still not getting the month and year for the archive to display:

              <h3>[+wp_month+] [+wp_year+]</h3>


              Any thoughts on that one? smiley
                • 18397
                • 3,250 Posts
                Give the latest development version a try, as it should fix that.