Was hoping to see if anyone knew how to do this.
I’m pulling my hair out trying to figure it out.
I’ve created a website on WordPress, with a custom theme.
I want a map to come up on the category page when it is visited.
Each of my category pages are names of Suburbs.
I’m using a plugin called 5SEC Gmap plugin which allows me to display a google map on a page with the simple shortcode [gmap]SUBURB NAME[/gmap]
I’m using the PHP shortcode code to put the shortcode into my theme template.
What I’m trying to do is use the single_cat_title as a variable so that the plugin pics up the suburb and displays it. The problem is, single_cat_title doesn’t work as intended.
<?php $address = single_cat_title(); if($address) : ?> <?php echo do_shortcode('[gmap]'.$address.', NSW[/gmap]');?> <?php endif; ?>
single_cat_title merely displays the name rather than storing it into the $address variable.
Is there another code in wordpress I can use that will help me with this – like get_single_cat_title? That obviously doesn’t work 🙂
- The topic ‘Single Cat Title into Shortcode’ is closed to new replies.