This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Hiding Search Bar

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #51705
    KimberlyAllenKimberlyAllen
    Participant

    is it possible to write a piece of code that tells the system to always display [wd_asp id=1] (header search) unless on page ID’s 13702 and 2428 then instead display [wd_asp id=3] and [wd_asp id=5] respectively?

    #51706
    Ernest MarcinkoErnest Marcinko
    Keymaster

    That is exactly what the code I suggested should do:

    add_filter( 'asp_shortcode_output', function( $output, $id ){
    	if ( $id != 1 ) {
    		return $output;
    	}
    	if ( get_the_ID() == 13702 || get_the_ID() == 2428 ) {
    		return '';
    	}
    
    	return $output;
    }, 10, 2 );

    If it doesn’t work, then there is something wrong I can’t foresee, unfortunately I can’t test this code on my end as it needs the exact same setup as yours.

    If you want, you can add temporary back-end and sFTP access, and I will debug this – it’s probably something very minor. I can’t guarantee anything (as custom code is beyond support), but I can try.

    #51707
    KimberlyAllenKimberlyAllen
    Participant

    and to confirm this is adding the code into functions.php

    #51708
    KimberlyAllenKimberlyAllen
    Participant

    not header.php or page.php

    #51709
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Yes, functions.php

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.