Title: A little do_shortcode() problem
Last modified: August 21, 2016

---

# A little do_shortcode() problem

 *  Resolved [irina76](https://wordpress.org/support/users/irina76/)
 * (@irina76)
 * [13 years ago](https://wordpress.org/support/topic/a-little-do_shortcode-problem/)
 * Hi. I’m trying to modify the source code of my theme but unfortunately my php-
   knowledge is too limited to get it right. Would really appreciate some help on
   hiding the post title.
 * Here’s what it looks like before I add the shortcode:
 * `<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>`
 * Here’s what I’ve done:
 *     ```
       <?php echo do_shortcode('[CBC country="se" show="n"]'
       <h2><a href="'.the_permalink().'">'.the_title().'</a></h2> '[/CBC]'); ?>
       ```
   
 * Result —> Parse error: syntax error, unexpected ‘>’
 * What am I missing?
 * [http://wordpress.org/extend/plugins/custom-content-by-country/](http://wordpress.org/extend/plugins/custom-content-by-country/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [13 years ago](https://wordpress.org/support/topic/a-little-do_shortcode-problem/#post-3814643)
 * Hi,
 * The problem you have here are the functions you’re using to displaying the parts
   of the title, and some syntax. Try this instead:
 * `echo do_shortcode( '[CBC country="se" show="n"]<h2><a href="'.get_permalink().'"
   >'.get_the_title().'</a></h2>[/CBC]');`
 * Let me know if that works for you.
    Cheers, Paul.
 *  Thread Starter [irina76](https://wordpress.org/support/users/irina76/)
 * (@irina76)
 * [13 years ago](https://wordpress.org/support/topic/a-little-do_shortcode-problem/#post-3814650)
 * Thanks Paul. This:
 * `<?php echo do_shortcode('[CBC country="se" show="n"]<h2><a href="'.get_permalink().'"
   >'.get_the_title().'</a></h2>[/CBC]'); ?>`
 * … gives me the following error:
 * Parse error: syntax error, unexpected T_ENDWHILE…
 * Actually it would be even better if there was some way to hide a category from
   certain countries. That way I could just assign posts to different categories
   and the front page would automatically display only the relevant posts for the
   country the visitor is coming from. Hope this explanation makes sense.. Maybe
   an idea for the next version of the plugin?
 *  Plugin Author [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * (@paultgoodchild)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/a-little-do_shortcode-problem/#post-3814677)
 * Hi,
 * You’re wrapping up what I put in the last post with <?php and ?>
 * Why? It depends on your PHP code if you need to do that. I can’t see any syntax
   error in my code, which would mean how you’re adding it to your code may be wrong.
 * As for categories and things like that, that goes too far into the theme and 
   display of content for this plugin. You’d need a multilingual plugin to handle
   what you’re looking to achieve.
 * Cheers,
    Paul.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘A little do_shortcode() problem’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-by-country.svg)
 * [Custom Content by Country (by Shield Security)](https://wordpress.org/plugins/custom-content-by-country/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-content-by-country/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-by-country/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-by-country/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-by-country/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-by-country/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Paul](https://wordpress.org/support/users/paultgoodchild/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/a-little-do_shortcode-problem/#post-3814677)
 * Status: resolved