Display content from custom field on blogpage/homepage (3 posts)

  1. craigdanovich
    Posted 4 years ago #

    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>
    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!

  2. craigdanovich
    Posted 4 years ago #

    The code from here, which correctly displays the custom fields on the hello & welcome section was removed above for being too long.

    It can now be viewed here instead..sorry

    hoping someone can help..

    thanks again..

  3. craigdanovich
    Posted 4 years ago #

    something to do with the loop maybe?

Topic Closed

This topic has been closed to new replies.

About this Topic