0

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)

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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