Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Can’t get_post_meta!! Help

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29693
    stormbytes
    Member

    I’m new to wordpress theming. I’m using WP 3.0, with my home page set to "home" in reading prefs, which pull a template file page-home.php.

    Inside page-home.php I’m trying to execute the following function:

    PROBLEM:

    Code:
    echo get_post_meta( $post->ID, ‘gallery_name’, true );

    doesn’t work!

    I’ve scoured the web/codex/forums and I just can’t make left from right!

    Is there anything obvious I’m missing?

    Thanks people!

    Code:
    function post_gallery() {

    query_posts(‘category_name=portfolio’); // Get Posts in category Portfolio

    if( have_posts() ) :

    $i = 0; // Declare Loop Couter

    echo “nt

    n”; // Open (initial) PARENT Div

    while( have_posts() ) : the_post();

    echo the_title();

    echo get_post_meta( $post->ID, ‘gallery_name’, true );

    if( $i < 3) { // If less then 3 records in current Div (less then full row) echo "tt

    ” . “country” . “

    n”; // Gallery Member

    etc….

    endif;

    endwhile;

    endif;

    #80199
    stormbytes
    Member

    I just globalized $post and it seems to be working, but I dont’ understand why that is. I’ve pretty much copied my code (with some mods) straight from Chris’s screencast on Advanced Custom Fields use in WordPress.

    What am I missing here?

    Cheers!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.