Forums

Menu description (3 posts)

  1. aurrutia
    Member
    Posted 3 years ago #

    Hi I want to create a description under menu items using Custom fields

    That's the code I got but only shows just one value for the custom field called subtitulo:

    $texto = get_post_meta($post->ID, 'subtitulo', true);
    <p>echo $texto</p>

    Any idea?, thanks.

  2. stvwlf
    Member
    Posted 3 years ago #

    Your question is not clear - do you have more than one custom field named subtitulo in a single post? You are trying to retrieve more than one subtitulo from one post?

    Then leave the 3rd parameter, true, off. just
    $texto = get_post_meta($post->ID, 'subtitulo');

    That will return an array of all the entries with that name

    http://codex.wordpress.org/Using_Custom_Fields#Getting_Custom_Fields

  3. aurrutia
    Member
    Posted 3 years ago #

    Thanks stvwlf,
    No, I want to retrieve one value from subtitulo custom field (1 per post) to show under every menu item, it's kind of description from every menu item.

Topic Closed

This topic has been closed to new replies.

About this Topic