January 20, 2013 at 4:44 pm #11412
Chris, we just updated from MapPressPro beta 2.38.7 to MapPressPro 2.39.7 and my post__in queries (in template files) are also broken, possibly similar to here. I’ve had these queries in through several versions without problem; I realize the syntax is a bit old, but it was working just great up to this update. Here’s an example of what we have in the template (we have several of these, on different custom post template pages, all broken):
<?php echo do_shortcode(‘[mashup width=”540″ height=”360″ maxZoom=”4″ maptypeid=”hybrid” marker_title=”post” marker_body=”none” directions=”none” overviewmapcontrol=”false” show=”query” show_query=”post_type=any&post__in=’.$mapIDs.'”]’);?>
and $mapIDs seems to be working fine as well…I echoed the string and it outputs (for one example)
I even inserted a smaller number of these IDs in as literals (e.g., “post_type=any&post__in=223,4072”) and it still didn’t work. I’ve removed other parameters to see if they’re the culprit, replaced the show_query with more recent syntax, but nothing works.
Note that all the rest of my mashups are working fine in templates, just the ones with the post__in logic aren’t.
Thanks as usual!
Jim P.January 20, 2013 at 8:40 pm #11413
I’ll be happy to look into it. The query problem with ‘array’ parameters was fixed in 2.39.6, or at least I thought it was.
Can you provide a link to a page with the problem so I can see what’s getting sent in with the query?
Also, if you could echo the entire query, and let me know it is, that would be helpful. I think you could code like:
<?php echo ‘[mashup width=”540″ height=”360″ maxZoom=”4″ maptypeid=”hybrid” marker_title=”post” marker_body=”none” directions=”none” overviewmapcontrol=”false” show=”query” show_query=”post_type=any&post__in=’.$mapIDs.'”]‘; ?>January 21, 2013 at 4:05 am #11418
Chris, thanks; link to sample page with this code is here. I’ve temporarily uncommented the $mapIDs echo so you’ll see that string at top. What you’ll see is a blank map. The full query code is below; it basically harvests geotagged posts (of several kinds) that were selected by the user. Again, it all worked great up to the upgrade.
As to your replacement code, can you actually do <?php echo ‘[shortcodegoeshere]’;?> and not include the do_shortcode?? Guess I have stuff to learn ;-).
JimJanuary 22, 2013 at 5:03 am #11429
The code was to echo the shortcode string, I wanted to see what was being passed to the plugin.
I was able to check using the sample page and I found the problem: for query argument “post_type=any”, the plugin is sending an array. WP_Query requires an array for multiple post types, but for “any” it requires a string.
This is fixed in 2.39.8, which should be out later today.
Until then, you can get it working by specifying a post type (“post_type=post”) or just removing the “post_type=any” clause from the query.
Thanks for letting me know about the problem!January 22, 2013 at 5:08 am #11430
Chris, thank you! I’m using post_type=any as the routine harvests geotags from several post types, including custom posts…will wait for update, and sure appreciate it…
JimJanuary 22, 2013 at 5:46 am #11432
Ok, the update will be out soon. This should also work if you don’t want to wait: “post_type=a,b,c” where a,b,c are your types.January 22, 2013 at 6:06 am #11434
Thanks; this works too!
- You must be logged in to reply to this topic.