WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I'm trying to use this plugin: http://wordpress.org/extend/plugins/wordpress-simple-website-screenshot/

I am supposed to use the shortcode: [screenshot url="www.example.com"] Because I am writing the code in the single.php file I am using:

<?php echo do_shortcode( '[screenshot url="www.example.com"]' ); ?>

But, my problem is that the URL is defined in the title of the post, so I tried:

<?php echo do_shortcode( '[screenshot url="<?php the_title(); ?>"]' ); ?>

with no luck.

Is it possible to do a workaround on this?

share|improve this question
I need something similar & I can't get my code to work. Please help. <?php echo do_shortcode( '[expand title="'.the_title().'"]'.the_content().'[/expand]'); ?> – user4561 Apr 10 '11 at 1:04
@Elizabeth, Hi could you please post a new question with more details. – Chris_O Apr 12 '11 at 6:18
up vote 2 down vote accepted

You're trying to execute PHP inside a string! Instead, concat the string;

<?php echo do_shortcode( '[screenshot url="' . get_the_title() . '"]' ); ?>
share|improve this answer
Thanks! It worked, I only needed to remove a space "'HERE. get_the_title(). For others: Use <?php echo do_shortcode( '[screenshot url="'. get_the_title() . '"]' ); ?> – Anders Mar 15 '11 at 15:15
That space is for readbility. It won't be included in the final string!!! phphowto.blogspot.com/2006/12/concatenate-strings.html – TheDeadMedic Mar 15 '11 at 17:02

Your problem is that <?php the_title(); ?> inside quotation marks doesn't really works change:

<?php echo do_shortcode( '[screenshot url="<?php the_title(); ?>"]' ); ?> 

to :

<?php echo do_shortcode( '[screenshot url="'.the_title().'"]' ); ?> 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.