Support

Account

Home Forums General Issues Get HTML Tag inside Custom Text Area

Solved

Get HTML Tag inside Custom Text Area

  • Is anyway possible with a snippet, to get from a custom Text Area field with different titles and paragraphs only the <H1> and not the rest of the content.

    Something like:
    echo get_field('content_left', 'h1');

    Thanks in advanced for any feedback.

  • Hi @blasphemine

    You can’t use the get_field in this way, but you can use some simple PHP to do so like this:

    
    $text = get_field('content_left');
    $text = explode('</h1>', $text);
    $text = current($text) . '</h1>';
    
    echo $text;
    

    Not sure if that actually works, but the logic is there.

    Thanks
    E

  • That’s a way too.
    Thank you @elliot!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Get HTML Tag inside Custom Text Area’ is closed to new replies.