Tagged: x
-
AuthorPosts
-
December 23, 2016 at 4:24 am #1302625
hjafferParticipantHi
I’m trying to echo an ACF within a shortcode but It’s driving me crazy. Here’s what I’m trying to achieve.
<?php if ( get_field( 'app_size' ) < 100 ) { echo "<?php the_field( 'app_size' ); ?> MB"; } else { echo do_shortcode( '[extra href="#" title="Beware!" info="popover" info_place="top" info_trigger="hover" info_content="CONTENT HERE" ]<?php the_field( 'app_size' ); ?> MB[/extra]' ); } ?>The statement works, only thing is I can’t figure out how to add the ACF in the shortcode in the second part of it (the shortcode).
Any chance you could help here?
Thanks
December 23, 2016 at 4:40 am #1302632
Rue NelModeratorHello There,
Thanks for writing in! You can simply use this code:
<?php if ( get_field( 'app_size' ) < 100 ) { echo "<?php the_field( 'app_size' ); ?> MB"; } else { $shortcode = '[extra href="#" title="Beware!" info="popover" info_place="top" info_trigger="hover" info_content="CONTENT HERE" ]' . the_field( 'app_size' ) . ' MB[/extra]'; echo do_shortcode( $shortcode ); } ?>We would loved to know if this has work for you. Thank you.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1302625 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
