WordPress.org

Forums

Add div to the_content (2 posts)

  1. allanlud
    Member
    Posted 1 year ago #

    Hi all,

    I want to add a div to the start on the_content in WordPress but I'm not sure how to write this up:

    function custom_fields($content){
        return preg_replace('<div class="offer_intro"><?= get_post_meta($post->ID, "offer_intro", true); ?></div>', $content);
    }
    add_filter('the_content', 'custom_fields');

    Can anyone help with this?
    Thanks

  2. allanlud
    Member
    Posted 1 year ago #

    Just bumping this up, hoping someone can help.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.