Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS styling metaData

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #44168
    JokerMartini
    Participant

    Hey guys. I’m trying to style the metaData from a wordpress post. I need to make a for loop that goes through all the meta data (if there is some) and style it as follows

    (CUSTOME FIELD NAME GOES HERE)

    (CUSTOME FIELD VALUE GOES HERE)

    #132144
    Paulie_D
    Member

    So what is your question?

    How to style it…or how to achieve the loop?

    #132145
    JokerMartini
    Participant

    How to achieve the loop and style it?

    #132146
    pixelgrid
    Participant

    get post meta is your friend http://codex.wordpress.org/Function_Reference/get_post_meta

    simple use

    and then you get each field from its name saved

    you can read how to set the meta boxes here

    http://codex.wordpress.org/Function_Reference/add_meta_box

    #132150
    JokerMartini
    Participant

    I’m not exactly sure to how write the for loop and add in my styling divs for the name a value. Could someone help me do that?

    #132153
    pixelgrid
    Participant





    the code will work for as many post as you have queried and have these meta keys

    #132154
    JokerMartini
    Participant

    Awesome. Thank you very much for the help on this. It’s a keeper for sure.

    #132076
    JokerMartini
    Participant

    That didn’t quite work out. It went haywire and listed the post hundreds and hundreds of times.

    I want to take each custom field entry and style it. http://jokermartini.com/myStuff/temp.jpg

    customfield NAME goes in div class=”detailTitle”>NAME /div
    customfield VALUE goes in div class=”detailValue”>VALUE /div

    for each custom item on this project/post do…..
    div class=”projectDetails”
    div class=”detailTitle”>NAME /div
    div class=”detailValue”>VALUE /div
    /div

    This forloop is going on my Single.php

    #132155
    pixelgrid
    Participant

    what plugin are you using to add the custom fields?

    #132156
    JokerMartini
    Participant

    Nothing. I using the standard one that comes with wp

    #132157
    pixelgrid
    Participant

    also to the bottom there is a link saying use them in your theme. did you mind pressing it? im sure it has instructions how to do it

    #132158
    pixelgrid
    Participant

    in my code you have to replace the ‘custom_field_1_name’ with ‘Authors’ and the second line to ‘Studio’ did you do that?

    #132160
    JokerMartini
    Participant

    alright ill check that out.
    Thank you

    #132161
    JokerMartini
    Participant

    No I didn’t do that. I wanted it to automatically just continue going through however many custom fields there were.

    #132163
    pixelgrid
    Participant


    foreach ($meta as $key => $value){ ?>


    try this one

Viewing 15 posts - 1 through 15 (of 16 total)
  • The forum ‘CSS’ is closed to new topics and replies.