WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
up vote 0 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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