Question

I hope someone can help me, I am sure this is simple but for the life of me I cannot get it right.

<?php shopp('storefront','product', 'id=36' ); ?>

I want to make the 'id=36' a variable which is called from a custom meta box. The function I am using to call the ID number is $my_meta['price']

So I ended up with something like this: <?php shopp('storefront','product', 'id=$my_meta['price']' ); ?>Which doesn't work. When I insert this $my_meta['price'] into a post it displays the number successfully, so that is all working.

Can someone please help me figure this out?

Please and thanks.

Was it helpful?

Solution

Try <?php shopp('storefront','product', "id=" . $my_meta['price'] ); ?>

OTHER TIPS

You need to use double quotes with curly braces if you want to expand variables within strings:

<?php shopp('storefront', 'product', "id={$my_meta['price']}"); ?>

If you wish to only use single quotes, you can append the variable to the string:

<?php shopp('storefront', 'product', 'id=' . $my_meta['price']); ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top