• Hi, I have seen what the custom field can do, but I am bit novice. I need to add a custom piece of text to each post. This is the format:

    Contact: [email protected] or phone 555 555 5555
    or
    Contact: [email protected] or phone 444 444 4444

    How do I do this?
    With custom fields I have to add the number and url each time as I can’t leave the value empty.

    Please help

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter bareman

    (@bareman)

    Thanks, it looks great but sofar but I cannot get the entries to display in the front end.

    It’s what I wanted in the sense that I can define two options:

    – email 1
    – email 2

    and I can just select either one in the backend and post it. This is great because I need to have such an option, where with custom fields one has to re-enter each value everytime, as a key cannot be without the value.

    But as I said I am having a hard time getting the entry to actually display, am I missing something ?

    Yes I am still novice ..

    You will want to explore Using_Custom_Fields to learn to put code such as in your theme’s appropriate template(typically wp-content/themes/your-theme/index.php) to display custom fields.

    Other related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    This is an example by use of the custom field template plugin.

    TEMPLATE #0

    [Contact]
    type = text
    size = 35
    
    [Phone]
    type = text
    size = 35

    [cft] Shortcode Format
    FORMAT #0

    Contact: [Contact]
    phone: [Phone]

    In the post, you have to add this:
    [cft format=0]

    That’s it:)

    Very slick. Didn’t notice that you could do that with your plugin, Hiroaki Miyashita.

    Thread Starter bareman

    (@bareman)

    Holy smoke this works perfect, wow thanks guys. As soon as I added <?php the_meta(); ?> it finally displayed in the front end. I realise now that this plugin is related to the custom fields plugin, and thus you need to add the php code in your index.php

    Thread Starter bareman

    (@bareman)

    is there any way I can make the values actual email links WITHOUT the shortcode option? I am building this for somebody and he will struggle with adding variables in the post itself. I liked the idea that with this plugin you can just tick the option you want in the post, and it will display in the front end.

    Thread Starter bareman

    (@bareman)

    or can [cft format=0] somehow be embedded in the index.php instead of manually adding it to each post?

    I believe, if you want the custom fields displayed for every post then you will want to read my comments above about Using_Custom_Fields etc.

    If you are wanting to display a custom field as a link:
    https://selfconclusion.co.uk/2008/12/wp-custom-fields/

    The shortcode method, I believe, is for displaying the value inside the post (in the post content).

    The more traditional way is to use WordPress codes – such as the_meta – to call in your custom fields within your theme’s templates, but outside the body of the post. Doing this, no one does anything special to “display” the fields when you write a post. Just fill in the custom fields (fill in the email box of Custom Fields Templates), and it will appear where-ever you have placed the_meta

    Note that the_meta displays all Key-Value combinations.
    Email –
    Phone –
    Thumbnail image –
    etc.

    If you just want to display a particular one, then consult the specific codes in the links MichaelH gave, or try another plugin: Get Custom Fields plugin.

    Sorry to put this in the thread, not sure what else to do.

    Dgold, could you contact me? https://www.johnathanandersendesign.com/contact/ I’d like to see if you have discovered any work-arounds to the Checkbox List custom field. I read your comments at ImpressLab.com and I’m looking for the same thing. I found an update to rc_custom_field_gui, but the checkbox functionality is broken. See: https://www.seoclear.com/2007/09/24/add-permanent-custom-fields-to-your-wordpress-write-page/

    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Add custom field to each post’ is closed to new replies.