WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field - Setting a default Value (2 posts)

  1. lesaurus
    Member
    Posted 5 years ago #

    Could anyone help me with the following please.

    Every post that I write has the same two custom fields, one to embed a video, the other to fetch the thumbnail for it.

    At the moment i have to manually select and fill these. Although not terribly time consuming it really seems to be adding up as i am writing more and more posts as the days go by.

    What I would like is for the post template to already be part filled, with both the keys selected and one of the values filled in, which i can then tweek.

    I don't know if or where i can access the code to add a default value, or if there is a plugin that would give me control.

    Any pointers would be great and really take the repetition out of the work.

    Thanks in advance.

  2. Dgold
    Member
    Posted 5 years ago #

    Try this excellent tutorial,
    http://epicalex.com/default-custom-fields/

    It does not fill-in a default value. Instead, this tells you the PHP code for an if-then statement. It works like this (translated to English):

    IF custom field exists, then display the custom field. IF the custom field is empty, then display this default instead.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.