WordPress.org

Ready to get started?Download WordPress

Forums

Custom field problem - what is result when there is no key for that post (2 posts)

  1. duda
    Member
    Posted 6 years ago #

    I wanna have title to be my custom field.But if i forgot to set custom field key for that post i wanna title for i would like seo_title_tag() function to display the title.

    So when there is no custom field(key) what is the result ... what is the value of $key.

    This is the value i want to put instead of THEREISNOKEY

    my code:
    <?php

    $key="title_tag"if ( $key=="THEREISNOKEY" ) { seo_title_tag(); } else { echo

    get_post_meta($post->ID, $key, true);

    ?>

  2. duda
    Member
    Posted 6 years ago #

    anybody?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.