[resolved] Custom fields display in table (7 posts)

  1. dapis72
    Posted 4 years ago #


    I am new member here, so everyone hello.

    I am trying to do some blog pages where i will present some things with multiple custom fields in a post. My question is, since i have created fieldset, how to display this custom fields in post?

    I tried with single.php and getcustomfield, which works fine, but i would like to display customfields in a table. But this works only for single post. When i have more posts on page, customfields dont show up.

    Since you are more experience, is this way to use custom fields good or not?

    I would appreciate any idea or solution.

    This is how look JP Custom Field:

    Fieldset: Avtodom change delete
    Field Slug Type Enabled
    Vrsta avtodoma
    ad_new_vrsta_avtodoma select Yes

    Znamka avtodoma
    ad_new_znamka select Yes

    Leto predstavitve
    ad_new_letnik select Yes

    ad_new_motor inputtext Yes

    ad_new_slika01 uploadmedia Yes

    Thank you. Damian

  2. s_ha_dum
    Posted 4 years ago #

    I am not sure I understand you completely but I'll try. Forgive me if I am misinterpreting something.

    1) Anything you put in single.php will only show up when you display a single post only. To have the code operate for multiple posts you need to put the code on index.php, or any of several other template files depending on how your theme works.

    2) I am not aware of a getcustomfield() function. Possibly it is new with WP 3.2? There is a get_custom_fields(). Is that what you mean?

    3) Whatever the case, custom fields are tied to posts so you would need to retrieve the custom fields for each post.

  3. dapis72
    Posted 4 years ago #


    Thank you for replay. Yes I mean get_custom_fields.

    Well my question was, if I can organize somehow a table with many custom fields to display in a post?


  4. s_ha_dum
    Posted 4 years ago #

    Yes, you can display custom fields as a table but I'm still not sure what you are trying to do.

    Do you want to display all of the fields assigned to one post, or all of the fields assigned to multiple posts, or are you trying to display all of the available fields for all posts?

  5. dapis72
    Posted 4 years ago #

    For example....let's say 1 post is like 1 car.

    So I would like to show for each post all the characteristic of the car.

    Nice view would be to put that in table.

  6. s_ha_dum
    Posted 4 years ago #

    So, you have a post about a car and you have things like horsepower, gear ratio, fuel economy, whatever, in the custom fields, right? Then use <a href="http://codex.wordpress.org/Function_Reference/get_post_custom">get_post_custom()</a> and when you loop through it (foreach, for example) build a table.

  7. dapis72
    Posted 4 years ago #

    Thx for help, well I am very new in programming :)

    So I need to finf out about this foreach and where to put this....but i will look for solution. Thx for your time anyway.

    I find nice thing like Wp-Table, but have to find how to include my vustom fields.

Topic Closed

This topic has been closed to new replies.

About this Topic