Adding a custom field into the_content()

Anyway to add a custom field into the_content() somehow?

I have the AddThis plugin on my site and it shows up at the bottom of my site right before my custom field, I would like my custom field to show up at the very end of the_content() and then have the AddThis stuff show up.

Read More

Anyway to do this?

Related posts

1 comment

  1. Try the_content filter to append your field onto the content:

    function wpa_content_filter( $content ) {
        global $post;
        if( $meta = get_post_meta( $post->ID, 'reviewGrade', true ) ) {
            return $content . $meta;
        }
        return $content;
    }
    add_filter( 'the_content', 'wpa_content_filter', 10 );
    

    Use the priority argument of add_filter to control the order in which your function runs.

Comments are closed.