Echo Custom Field Key Inside PHP Echo Statement
-
Hopefully someone far more experienced working with theme files can help me.
I need to echo a custom field value inside of an already existing echo statement in my theme files. It seems straight-forward enough, but no amount of Googling has helped.
Here’s the code I’m working with:
<?php $product_id = get_post_meta($post->ID, 'product_id', true);if ($product_id) { ?> <?php echo get_button_code_for_product(<?php echo $product_id; ?>); ?> <?php} ?>The original line I started with was
<?php echo get_button_code_for_product(1); ?>I need to be able to echo each post’s product_id into the parentheses of the above code.
Any help? Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Echo Custom Field Key Inside PHP Echo Statement’ is closed to new replies.