The plugin doesn’t support that by default, but it might not be too hard to add it. I’ll look into it for one of the upcoming versions.
In the meantime, you could try adding some code like this to your theme’s function.php file
function bgmp_parse_shortcodes( $placemarks )
{
for( $i = 0; $i < count( $placemarks ); $i++ )
$placemarks[ $i ][ 'details' ] = do_shortcode( $placemarks[ $i ][ 'details' ] );
}
add_filter( 'bgmp_get-placemarks-return', 'bgmp_parse_shortcodes' );
Thread Starter
Gillian
(@ridgididgi)
Hi Ian
Many thanks for the code 🙂
I created a child theme and included the code in the child theme’s functions.php file, but unfortunately all my placemarks disappeared 🙁
Help! I have temporarily disabled the child theme’s functions.php file to get my placemarks back in the meantime.
Ridgididgi
Er, I forgot to return the $placemarks variable. Try this…
function bgmp_parse_shortcodes( $placemarks )
{
for( $i = 0; $i < count( $placemarks ); $i++ )
$placemarks[ $i ][ 'details' ] = do_shortcode( $placemarks[ $i ][ 'details' ] );
return $placemarks;
}
add_filter( 'bgmp_get-placemarks-return', 'bgmp_parse_shortcodes' );
Thread Starter
Gillian
(@ridgididgi)
Hi Ian
That is supercalifragilisticexpialidocious 🙂
It’s all working now, many thanks. It would be great to have the ability to include shortcodes in the custom post in an upcoming version of your plug-in.
For your info, the shortcode I wanted to include pulls data from the database so that a number (and its related percentage) is automatically updated in the info box as new entries are recorded in the database. The shortcode works fine in a page, but returns a zero (and divide by zero error for the percentage operation) in the placemark post. I got around that difficulty by using the Shortcode Exec PHP plug-in and creating two more shortcodes (one for the count and one for the percent) and then using the “echo do_shortcode” command to call up the respective original shortcodes.
I’m sure my convoluted solution isn’t optimal, but at least it works so I’m happy 🙂
Many thanks again for your great support and a belated Merry Christmas!
Ridgididgi