On the Minimum theme demo home page, there are six posts displayed (title, excerpt, post date, etc.) with navigation buttons following. Instead of displaying blog post data I need to display custom post type data (title, date, location, price) for an events custom post type. If this is do-able, could you provide me with some pointers on how to proceed. Thanks!
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)
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!
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!
You must be logged in to reply to this topic.
Subscribe to get early access to new themes, discounts and brief updates about what's new with StudioPress!