Show Dates in POI List

Home Forums MapPress Support Show Dates in POI List

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10060
    Jack
    Participant

      Hi Chris,

      I am building a site to track the movements of offshore drilling rigs using Mappress.  The current method I am using is by entering the date of the latest position as the name of POI, and then using mashup to display the chronological event for a particular rig using the POI list as a reference table.  But as of v2.38.5 beta:

      * [MapPress Pro](http://mappresspro.com/mappress) Fixed: For mashups, the POI title was displaying instead of the post title in tooltips and the POI list

      Is there any method to have the mashup POI list to also show the date of the Post?  Or do you have any other recommendations?

      #10064
      Chris
      Keymaster

        Hi, yes you can actually show anything you like in the POI list.

        I’m still working on the documentation so it’s not documented except in the release notes.  But the idea is you can modify a template, much like a theme template file:

        1) Find the file ‘map_poi_list’ in the MapPress directory /pro/templates

        2) Copy it to your theme directory

        3) Change the contents as needed.  I think you’ll need something like:

        <td><?php echo $post->post_date; ?></td>
        
        

         

        #10065
        Jack
        Participant

          Thanks for the feedback Chris.  I’ve followed your suggestion but unfortunately the $post->post_date; came up empty in the mashup POI list (have also adjusted the table to show the proper number of columns).  A var_dump shows NULL for the $post array when called from the map_poi_list template.  Am I missing something?

          #10068
          Chris
          Keymaster

            Hi,

            I’m sorry I was thinking of modifying the template for individual posts.  For the poi list you can read the post ID for each poi from the field $poi->postid;

            So you’ll need this in the ‘foreach’  loop:

            <td>
              <?php       
                if ($poi->postid) {
                  $p = get_post($postid);
                  echo $p->post_date;
                }      
              ?>     
            </td>

            Don’t forget to add a “<th>” header for the column too.

            I hope that helps.  If you like I can also email you the whole file.  Send me an email at “chrisvrichardson” at mappresspro.com.

            #10071
            Jack
            Participant

              Thanks Chris – I think we’re getting close to solving this.  The ‘foreach’ loop above is strangely putting out the date of the page where the mashup resides.  I would like for it to show the date of the POI posts instead.  Apologies if I was not clear earlier: I create individual Posts for each POI, and use a Page to show the mashup by running shortcode query on particular category.
              [mashup show="query" show_query="posts_per_page=-1&category_name=jack-bates" poilist="true" marker_title="marker" marker_body="marker" width="100%" height="400" tooltips="true"]
              If it helps, the link to sample Page of the mashup follows: http://rigspot.net/rig/jack-bates/

              #10073
              Chris
              Keymaster

                There’s a bug in my little code snippet – I wrote $postid instead of $poi->postid, so it always prints the first date.  I didn’t realize the dates were repeating when I tried it.

                It should be as shown below.  I tested it and it looked OK.  Hopefully it’ll work for you as well:

                <td>
                  <?php
                    if ($poi->postid) {        
                      $p = get_post($poi->postid);        
                      echo $p->post_date;       
                    }      
                  ?>     
                </td>

                 

                #10075
                Jack
                Participant

                  It works wonderfully now.  Thanks Chris.

                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.