WordPress.org

Ready to get started?Download WordPress

Forums

Custom Fields Creator
Plugin - Custom Fields Creator:jQuery shortcode in textarea (2 posts)

  1. NFWRo
    Member
    Posted 1 year ago #

    Hi
    What a fantastic plugin!
    I'm using it to display testimonials on a customers site. Some of the texts are quite long and when I had them as html text just in a page, I was using the jQuery Collapse-O-Matic plugin to make the divs collapsible using the [expand][/expand] shortcodes in the div itself.

    Is there a way to use this when the text is included in a textarea?

    Thanks

    http://wordpress.org/extend/plugins/custom-fields-creator/

  2. NFWRo
    Member
    Posted 1 year ago #

    Well I've been doing some searching around and it seems that I need to use the do_shortcode function from the codex. I've tried a number of different ways suggested by people in blogs and forum posts, but none of them seem to work in my code. I have a custom field that outputs a styled div for customers testimonials on a page template with the following code in:

    <?php
    $testimonial = get_post_meta($post->ID, 'testimonial', true);
    foreach($testimonial as $testimonial){
    echo '<div class="testimonial">';
    echo '<p>' . $testimonial['testimonial-text'] . '</p>';
    echo '<p class="testimonialname">' . $testimonial['testimonial-name'] . '</p>';
    echo '</div>';
    }
    ?>

    I think I need to use the
    echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');
    from the codex as I have an [expand][/expand] shortcode that creates a collapsible div when there is a lot of testimonial text.

    Can anyone help me as to how to correctly insert this into my code so that it is only used when the shortcode is present in the custom field value?

    Any help very greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic