Show global block above a cpt archive page

hi there,

is there a way to show a global block above a custom post and custom pst archive page, made with cptui?

i tried this code but getting a fatal error

// Right after the header jobs
function add_block_before_the_content_begin() {   
    if( is_singular('jobs') || is_home() ){
        echo do_shortcode('[cs_gb id=930]');
    }
}
add_action( 'x_after_masthead_end', 'add_block_before_the_content_begin');

// Right before the footer jobs
function add_block_after_the_content() {   
    if( is_singular('jobs') || is_home() ){
        echo do_shortcode('[cs_gb id=931]');
    }
}
add_action( 'x_before_colophon_begin', 'add_block_after_the_content');

jobs is my slug for the custom post. i have to mention that i allready show a global block for the normal post type. but this is a different gb.
credentials in secure note.

thanks in advance

Hey Harald,

Technically, yes. However, this would require custom development work and we do not provide that as part of product support.

I can just confirm that using the x_after_masthead_end works so it could be that your conditions are incorrect. Please verify those with the CPTUI plugin author or consult with a developer on that one.

Thank you for understanding.

hi,
i figured it out, had to change the code a little bit:

// Right after the header posts
function add_block_before_the_content_begin() {   
if( is_singular('post') || is_home() ){
    echo do_shortcode('[cs_gb id=541]');
}
else if( is_singular('jobs')){
    echo do_shortcode('[cs_gb id=930]');
}
	else if( is_singular('jobs') || is_archive() ){
    echo do_shortcode('[cs_gb id=930]');
}
}

thanks

Hey Harald,

We are just glad that you have figured out a way to correct the said issue.
Thanks for letting us know!

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.