Forums

Displaying my custom fields in 2 columns (2 posts)

  1. juicyart
    Member
    Posted 3 years ago #

    What I'm trying to do is show my 9 custom fields in 2 columns at the bottom of the page. Just using the simple "the_meta()" tag puts all the custom fields, including those used by the ratings plugin, into an unordered list.

    You can see what I'm trying to do here

    I have the divs & CSS setup there, however I don't know how to call the keys individually - only the key values <?php $key="Accepts Credit Card"; echo get_post_meta($post->ID, $key, true); ?> for example. At the moment I have the visible headers typed into the single.php file manually.

    What I'd like to know is how to call the key & key value for each of my 9 custom fields manually so that they only display in those 2 columns if the value for that key is filled out. Obviously, typing the "headers" (key names) in manually will always display them at the bottom of each post. I tried using the info from the Codex page on custom fields, but I must not be understanding it because it didn't work for me.

  2. juicyart
    Member
    Posted 3 years ago #

    My example with the manual html key names is no longer there because I modified the PHP for the ratings plugin to tide me over in the mean time. I added _ to the 3 custom fields for the ratings plugin throughout all of its code so that the custom fields won't display on the pages.

    That being said, I'd still like to know how to do what I was asking if anyone knows :)

Topic Closed

This topic has been closed to new replies.

About this Topic