New POI fields do not show on single post map, but do show on mashup

Home Forums MapPress Support New POI fields do not show on single post map, but do show on mashup

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15926
    ReallyGreen
    Participant

    Hi there,

    Thanks for a great plugin – I’ve managed to achieve a lot with it, but hit a stumbling block.

    When I publish a new map post, the POI appears perfectly on my mashup map, with all my required custom fields displayed in the tooltip/pop-up.

    But oddly, the POI information does not display on the single map post.

    This is my POI info:

    <div><?php echo $poi->get_thumbnail(array('class' => 'mapp-thumb')); ?></div>
            <strong>Grid Reference:</strong> <?php echo get_post_meta($poi->postid, 'wpcf-grid_reference', true); ?><br>
            <strong>Recorder's Name:</strong> <?php echo get_post_meta($poi->postid, 'recorder_name', true); ?><br>
    		<strong>Sighting Date:</strong> <?php echo get_post_meta($poi->postid, 'sighting_date', true); ?><br>

    On my POI, I see the headings, but no output, so I don’t see the featured image etc.

    My mashup shortcode is:

    [mashup query="post_type=squirrel-sightings" center_lat="52.136791" center_lng="-3.782034" marker_link="false" width="100%" height="700" zoom="11"]

    Any ideas?

    Thanks,
    James

    #15932
    Chris
    Keymaster

    Hi,

    The problem is that the plugin only sets $poi->postid for mashups. For individual maps you’ll need to take the current post ID from the global $post.

    I’d like to to get this fixed, since it’s inconsistent – but until then you can use something like this:

    
    <?php global $post; ?>
    <?php $postid = ($poi->postid) ? $poi->postid : $post->ID; ?>
    <div><?php echo get_the_post_thumbnail($postid); ?></div>
    <strong>Grid Reference:</strong> <?php echo get_post_meta($postid, 'wpcf-grid_reference', true); ?><br>
    <strong>Recorder's Name:</strong> <?php echo get_post_meta($postid, 'recorder_name', true); ?><br>
    <strong>Sighting Date:</strong> <?php echo get_post_meta($postid, 'sighting_date', true); ?><br>
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.