WordPress.org

Support

Support » How-To and Troubleshooting » Add div to the_content

Add div to the_content

  • 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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add div to the_content’ is closed to new replies.
Skip to toolbar