• Resolved mc_raz

    (@mc_raz)


    I have tried everything to get the custom fields to display below my posts. I am very new to this stuff so I don’t know what I am doing wrong. I am trying to modify my single.php by adding get_post_custom()

    I have tried many variations but here is one of the examples of the loop in my single.php

    <?php
    if (have_posts()){
    /* Display navigation to next/previous posts when applicable */
    if (theme_get_option(‘theme_top_single_navigation’)) {
    theme_page_navigation(
    array(
    ‘next_link’ => theme_get_previous_post_link(‘« %link’),
    ‘prev_link’ => theme_get_next_post_link(‘%link »’)
    )
    );
    }

    while (have_posts())
    {
    the_post();
    get_template_part(‘content’, ‘single’);
    $custom_fields = get_post_custom();
    comments_template();
    }

    /* Display navigation to next/previous posts when applicable */
    if (theme_get_option(‘theme_bottom_single_navigation’)) {
    theme_page_navigation(
    array(
    ‘next_link’ => theme_get_previous_post_link(‘« %link’),
    ‘prev_link’ => theme_get_next_post_link(‘%link »’)
    )
    );
    }

    } else {

    theme_404_content();

    }
    ?>

    Was hoping someone could point out what I am doing wrong or do I need to modify another file as well like my functions.php?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with the_meta()

    Thread Starter mc_raz

    (@mc_raz)

    I can’t believe you answered something in 2 seconds that I have been trying to figure out for hours. Thank you so much!

    Could you point me in the right direction for styling the keys eg: make the keys bold?

    Moderator keesiemeijer

    (@keesiemeijer)

    For that it’s best we have a link to your site.

    Try putting this in your theme’s stylesheet style.css:

    .post-meta {
    	font-weight: bold;
    }

    Thread Starter mc_raz

    (@mc_raz)

    I haven’t actually moved it across to the site that plan on using it just yet. I have an experiment site that is pretty much a frankenstein for all sorts of testing.

    I have been at this all day so I will investigate the .post-meta tomorrow morning and see how I go. If I can’t figure it out I will post again.

    Thank you so much for your help, I really appreciate it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get_post_custom() issue’ is closed to new replies.