Home › Forums › Add-ons › Flexible Content Field › Using shortcodes with the flexible content loop › Reply To: Using shortcodes with the flexible content loop
I ran into this issue and this article helped http://kovshenin.com/2013/get_template_part-within-shortcodes/.
1. Put the loop in a php file.
2. Then set up your shortcode like this:
function myshortcode( $attr ) {
ob_start();
get_template_part(‘php’,’file’);
return ob_get_clean();
}
add_shortcode( ‘shortcode’, ‘myshortcode’ );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.