I am new to wordpress development as well as php and html programming and I need some help with something. I would like to get the title of a bbPress topic and then store that in a variable. Then I would like to use this variable within some shortcode however I am not sure how to do this.

This is what I have so far:

    <?php $name = "appl"; ?>
    <?php echo do_shortcode('[mstock asset="'. $name . '" info="company_name"]');?>

This however doesn't seem to be working. For now the variable "name" is set by me but that will change to a function once I get this sorted. Without the use of the variable the shortcode works like this:

<?php echo do_shortcode('[mstock asset="appl" info="company_name"]');?>

Many thanks!

Your Answer

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

Browse other questions tagged or ask your own question.