gmw

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts

  • gmw
    Participant

    Never mind. I forgot to set global $post.

    A more important question would be is this a good way to accomplish my goal (displaying custom post types on home page). Honestly, I don’t know what I am doing here. I see all of these hooks and actions and wonder if there is a better way of accomplishing my goal and not building in problems down the road. Thanks!


    gmw
    Participant

    I am able to create and update custom post types on the WP back-end and I can see all the data wp_postmeta via phpmyadmin. To display my CPT on the home page I modified home.php by commenting out the call to genesis_standard_loop(); I then created my own function gmw_events_loop();

    here is a snippet in my new function that I am having a problem with:

    $wp_query = new WP_Query( $args );
    while ( $wp_query->have_posts() ) : $wp_query->the_post();
    $meta = get_post_meta($post->ID, ‘gmw_events_meta’, true);

    (save the_title and meta data to array)

    endwhile;

    the_title (from wp_posts) returns the event name fine. My problem is that $post->ID is empty and therefore get_post_meta() returns nothing. If I hardcode the post_id into get_post_meta(), it works fine. It works in a simple theme I developed. I don’t know why it doesn’t work here. Any suggestions? Thx!

    • This reply was modified 1 year, 12 months ago by  gmw.
    • This reply was modified 1 year, 12 months ago by  gmw.
    • This reply was modified 1 year, 12 months ago by  gmw.
    • This reply was modified 1 year, 12 months ago by  gmw.
    • This reply was modified 1 year, 12 months ago by  gmw.
    • This reply was modified 1 year, 12 months ago by  gmw.
    in reply to: Need clarification on support options #2150

    gmw
    Participant

    Got it. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)