I am using developing a child theme for Woothemes' Canvas.

I am trying to use functions.php in the child theme to only use actions on my custom post type.

This code doesn't seem to be working:

 add_action( 'woo_post_inside_after', 'my_geo_mashup' );
function my_geo_mashup() {
       echo GeoMashup::map();
    if ($post->post_type == 'listings') {
        //My function
       }
}

add_action( 'woo_post_inside_before', 'listings_nivo' );
function listings_nivo() {
echo do_shortcode('[nivo source="current-post" ]');
 if ($post->post_type == 'listings') {
        //My function
       }
}

So, I'm unsure how to get the above to work properly and only show these items on the custom post type, or only for the custom post type template single-listings.php (as I only want the map and slider to show on the actual post, not on the blog page (archive.php)

link|improve this question

75% accept rate
feedback

1 Answer

up vote 0 down vote accepted

you need a global $post; within that function before trying to access the contents of $post.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.