Try this:
<?php echo do_shortcode( '[to_like]' . do_action('single_spot_after_content', get_the_ID(), 'after_content') . '[/to_like]' ); ?>
题
I am trying to insert PHP code in a shortcode.
For now it look likes this:
<?php echo do_shortcode('[to_like][/to_like]'); ?>
<?php do_action('single_spot_after_content', get_the_ID(), 'after_content'); ?>
I have tried several plugins to combine this to one shortcode (PHP shortcode plugin, Advanced Custom fields, etc.)
This is what I want to accomplish, but it is not working:
<?php echo do_shortcode('[to_like]<?php do_action('single_spot_after_content', get_the_ID(), 'after_content'); ?>
[/to_like]'); ?>
In the front-end the user can select the value through a dropdown field --> for example 10% discount (this is going to be displayed when a visitor likes the box). The theme has a special markup field (you can create custom submission fields) where %% is going to be changed by the chosen value from the customer. This value is going to be displayed on the website (singe listing page).
How can I implement this? This is so vital for the website.
解决方案
Try this:
<?php echo do_shortcode( '[to_like]' . do_action('single_spot_after_content', get_the_ID(), 'after_content') . '[/to_like]' ); ?>