Support » Plugin: WP Bannerize » Custom post types

  • Resolved agiovine


    I was playing with the shortcodes to try to figure out a way to do this, but haven’t been successful. I am using a custom post type, and this custom post type has its own categories. Is there a way to write the shortcode that will allow me

    1) to show certain ads on certain custom post type categories?
    2) to prevent ads that are for regular posts from appearing on custom post types?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author gfazioli


    Hi there,

    and sorry for the delay.

    Yes, you can but you have to write some lines of code.

    First of all, which version of Bannerize are you using? WP Bannerize or WP Bannerize Pro?

    Regular WP Bannerize, non-pro version. But it is the up to date version.

    Plugin Author gfazioli



    sorry for the delay. So, you can:

    Edit the functions.php file in your theme and add the following line:

    add_shortcode( "agiovine_category", "agiovine_category" );
    function agiovine_category( $atts = [], $content = null )
        global $post;
        $defaults = [
          'post_type' => false,
          'taxonomy'  => false,
          'category'  => false,
        $atts = shortcode_atts( $defaults, $atts, 'agiovine_category' );
        if ( empty( $atts[ 'post_type' ] ) || empty( $atts[ 'taxonomy' ] ) || empty( $atts[ 'category' ] ) ) {
          return $content;
        if ( $post->post_type === $atts[ 'post_type' ] && has_term( $atts[ 'category' ], $atts[ 'taxonomy' ] ) ) {
          return $content;
        return "";

    Then, in your post you’ll able to use:

    [agiovine_category post_type="wp_kirk_cpt" taxonomy="wp_kirk_tax" category="enterprise"]
    I'm visible only for the custom post type wp_kirk_cpt, taxonomy wp_kirk_tax
    and category enterprise

    The wp_kirk_cpt is the slug id of your Custom Post Type.
    The wp_kirk_tax is the slug id of your Custom Post Taxonomy
    The enterprise – for example – is the slug of category

    Of course, you’ll use:

    [agiovine_category post_type="wp_kirk_cpt" taxonomy="wp_kirk_tax" category="enterprise"]

    In the above sample, wp_bannerize will be display only for that category.

    Let me know if you need any help or information.

    • This reply was modified 1 year, 3 months ago by  gfazioli.
    Plugin Author gfazioli


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom post types’ is closed to new replies.