Add action to only a custom post type – functions.php
-
Hi,
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)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add action to only a custom post type – functions.php’ is closed to new replies.