WordPress.org

Ready to get started?Download WordPress

Ideas

Add parameter for Exclude a particular custom field key from the_meta output

  1. Dgold
    Member

    12345

    Template tag, the_meta , has no parameters currently.

    Please add a parameter so that the_meta can EXCLUDE a particular Key-Value.

    It could be something like, php the_meta(exclue="Small-image")

    REASONING AND EXAMPLE:

    the_meta will display all the custom fields on a post. It will display them as Key - Value pairs. For example I could make my post display:
    My Mood: Happy
    The Weather Is: Sunshine
    The song of the day is: "You Are My Sunshine"
    Small-image: http://mysite.com/wordpress/wp-content/november-sun.jpg

    In my example I want the_meta to show all the custom fields EXCEPT for "small-image".

    The other custom fields are intended for public display, but I use one of my custom fields for some code-like info that I don't want to display in writing on the blog where I put the_meta.

    Adding this parameter would be backwards compatible with older WP. The old way of putting the_meta() would still work fine.

    Posted: 5 years ago #
  2. Dgold
    Member

    12345

    MichaelH posted some code in the Support Forum. Code to put in The Loop that will Exclude certain named custom-fields from the output of the_meta() function.

    The code is described here,
    http://wordpress.org/support/topic/217076

    I still believe this should be integrated as a Parameter on the_meta in the WordPress core.

    Posted: 5 years ago #
  3. krembo99
    Member

    12345

    Great Idea, I had the same problem on some websites, and had to use the individual meta names.
    This system is much much better.
    Implementation is a must IMHO being all teh custom plugins that use the_meta as for today.

    Posted: 4 years ago #
  4. I believe key names beginning with underscores are automatically ignored, so you could use _small-image in your example.

    Of course, there's now the post-thumbnail field as well.

    Posted: 4 years ago #
  5. Mark
    Member

    12345

    You can easily display custom fields selectively using PHP variables.

    Posted: 4 years ago #
  6. Mark / t31os
    Member

    12345

    Stephanie's suggestion is a great one, meta keys starting with underscores should be ignored.

    Posted: 4 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    6 Votes
  • Status

    This idea is under consideration