WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Template
custom field values on the frontend (6 posts)

  1. swtrven
    Member
    Posted 2 years ago #

    I'm at my limit and begging for some guidance! (Don't want to hire someone... I want to learn it, but I'm missing something!) I have tried every plugin free & many paid. I can't seem to get custom data to show up on the frontend. I know what php looks like and that's about it! Could someone please show me an example to get the values on my site?? I have used just about ever tutorial I could find and they all lack in getting all the custom stuff to actually show up!

    By the way I'm using Genesis framework with a child theme in case that matters any.

    Thanks!

    http://wordpress.org/extend/plugins/custom-field-template/

  2. nancyeb01
    Member
    Posted 2 years ago #

    Hi,
    I was looking for the same thing. I found a solution and maybe it will work for you. In my theme, I edited the page 'single.php'. This is the template for my Post page.

    I was looking to add this: <?php the_meta(); ?> in the loop.

    You need to find the correct place to insert it and then save the page. I use an FTP program and Dreamweaver. I have a copy on my local computer of the files that are on my server and use FTP to copy back and forth.

    BTW, before I change any file, I copy the original and give it a name - singleORIG.php. That way, I can go back if I break something.

    The single.php file will be slightly different depending on the theme. Here is where I inserted the meta code in one theme:

    This is an excerpt inside what is called the loop.
    <!-- post content -->
    <div class="entry-content clearfix">
    <?php the_content(); ?>
    <?php the_meta(); ?>
    </div>

    Another theme I use has a slightly different single.php, and I inserted the meta code as follows:

    <div class="loop">
    <div class="loop-content">
    <?php while ( have_posts() ) : // The Loop ?>
    <?php the_post(); ?>

    <?php get_template_part( 'content', 'single' ); ?>
    <?php the_meta(); ?>
    <?php comments_template(); // include comments template ?>
    <?php endwhile; // end of one post ?>
    </div>

    I hope that helps you.

    Nancy

  3. nancyeb01
    Member
    Posted 2 years ago #

    I found a tutorial that explains it better than I can. http://perishablepress.com/wordpress-custom-fields-tutorial/

  4. Pyph
    Member
    Posted 2 years ago #

    output = true

    after the field form and it should appear. My only problem - I can't get it to disappear now! :-(

  5. Pyph
    Member
    Posted 2 years ago #

    e.g.

    [favourite book]
    type = text
    label = What's your favourite book?
    output = true

  6. Pyph
    Member
    Posted 2 years ago #

    another option is

    echo get_post_meta($post->ID, $custom_field_key, true);

    (remembered why it wasn't disappearing. My bad - left some old testing code in my layout.)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic