0

Wondering if anyone knows how to get a toggle shortcode to render when using: get_post_custom

<?php
    $post_customs = get_post_custom();
    //$post_customs = the_sub_field('project_items');
    if(isset($post_customs["project_items"]) && count($post_customs["project_items"]) > 0) {
        $project_items = $post_customs["project_items"][0];
        $projectItems = explode(":",$project_items);
?>
            <?php if(count($projectItems) > 1) {
                $totalProjectItems = $projectItems[1];
                for($i = 0; $i < $totalProjectItems; $i++) {
            ?>

            <?php $pro_item_post = get_post($post_customs["project_items_".$i."_choose_project_item"][0]); ?>

Calling the content with:

            <aside class="one_half last">

                <?php echo $post_customs["project_items_".$i."_edit_proposal_item"][0]; ?>

            </aside><!--/.one_half -->

This renders out the shortcode within the content area i.e.: "[toggle title="Test"] CONTENT" instead of actually rendering it as a toggle. Any help would be appreciated.

1

You can use do_shortcode()

echo do_shortcode($post_customs["project_items_".$i."_edit_proposal_item"][0]);

More : http://codex.wordpress.org/Function_Reference/do_shortcode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.