Viewing 7 replies - 1 through 7 (of 7 total)
  • oblanda004

    (@oblanda004)

    I want this too. Is there some easy setup to do this automatic for every post?

    esmi

    (@esmi)

    @oblanda004: If you require assistance then, as per the Forum Welcome, please post your own topic.

    studiosx,

    The meta description is stored as custom metadata on the post, it is named _aioseop_description and you can do this using the get_post_meta() function and the “the_content” filter. Note that if you want to insert it in an arbitrary location within the post content, you might want to write a shortcode for this instead.

    oblanda004

    (@oblanda004)

    I know that is not your job and maybe this reques is retarded but can you tell me how to write that shortcode. I am noob, stupid and Bosnian. Please.

    oblanda004,

    I don’t mind providing simple examples; the main issue is figuring out exactly what people are trying to accomplish in the first place, when they ask a question. Here’s a simple example of how you’d do this:

    function oblanda_description_shortcode( $atts ) {
        global $post;
        $meta = '';
        if ( !empty( $post ) ) {
            $meta = get_post_meta( $post->ID, '_aioseop_description', true );
        }
        return $meta;
    }
    add_shortcode( 'showdesc', 'oblanda_description_shortcode' );

    Then you’d use the [showdesc] shortcode in the post content. You can add this code to the functions.php in your theme or to a plugin.

    oblanda004

    (@oblanda004)

    I trying to accomplish in the first place to not write content. I have video site and i thinking to have short description in post that would be and meta description and post content. I trying to have post meta description to look like this
    %post_title% | some text | %blog_title% | some text
    And that automatic be posted in my post to reduce writing. I hope you understand me and my tarzanian english. Is posible to doing that what i want?
    Thanks for help.

    Oblanda,

    In that case, you might want to look into using the post_content hook I mentioned earlier instead; I’m not sure how you’d go about automating the “some text” part either, unless that text doesn’t change.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘meta description as post content’ is closed to new replies.