I need to write a dynamic shortcode. The original says: [... width="940" height="200" ...]

I need to have this: [... width="<php>" height="<php>" ...]

How do I get this to happen??

Thanks, Floyd

  • Now there’s the problem. I tried to do something, that isn’t possible at all. Thanks for your answer though... I wish I had a better start in this forum. :) – Sgt Floyd Pepper Apr 8 '11 at 6:28

Shortcodes are plain text wrapper made exactly for cases when PHP code is not available or should not be used.

  1. You can concatenate that to string and evaluate it with do_shortcode().
  2. You can look up function that powers shortcode (set up with add_shortcode()) and use it in PHP code directly.
  • Sorry, my fault. I made a mistake in the question. I have this: <?php echo do_shortcode('[... width="940" height="200" ...); ?>and I want to have this: <?php echo do_shortcode('[... width="<javascript>" height="<javascript>" ...); ?> I know it is strange, but probably someone will get me... – Sgt Floyd Pepper Apr 6 '11 at 10:58
  • 2
    @Sgt. Floyd Pepper please edit your question with those details... And now I am even more confused about what you are trying to do. :) – Rarst Apr 6 '11 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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