Support » Fixing WordPress » Display content from custom field on blogpage/homepage

  • Hi, fingers crossed someone can help me…

    In the Thesis theme for wordpress i use my custom functions file to pull in and display content from custom fields on a specific page.

    If you look at the site here
    The ‘Hello & Welcome’ section is made up of content pulled from 4 custom fields.

    1.The photo (custom field name ‘introphoto’)
    2.the heading (custom field name ‘introheading’)
    3.the post text (custom field name ‘introtext’)
    4.the read more link (custom field name ‘introreadmorelink’)

    The code used to do this is:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    As you can see it works fine above. However the trouble comes when i go to do the same thing on a main blogpage; the page listing all posts.

    If you look at the blog page here you will see the same feature area but its blank. I am using the same custom field method explained above but for some reason its not displaying the custom field values.

    The code i am using; like before but for the blog page is:

    // *Featured Post */
    function postboxtop() {
    global $post;
    if (is_home())  {?>
    <div id="postboxtop">
    <img src="<?php echo get_post_meta($post->ID, 'postphoto', true); ?>"/>
    <h2><?php echo get_post_meta($post->ID, 'postboxheading', true); ?></h2>
    <p><?php echo get_post_meta($post->ID, 'postboxexcerpt', true); ?></p>
    </div>
    <?php
    }
    }
    add_action('thesis_hook_before_content', 'postboxtop');

    Can anyone maybe shine any light on why the custom field values are not displaying on this page? I would be eternally greatful.
    Thanks in advance to anyone who takes the time to write back.

    Heres hoping!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display content from custom field on blogpage/homepage’ is closed to new replies.