Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #987350

    Hi,

    I am trying the code below to modify posts, categories, tags. Adding is_archive() || is_tag()

    However only in the post did it work. In categories or tags nothing is modified.

    Any suggestion?

    //Add fixed menu to (post ID 15255) All tags All Category
    
    add_action( 'ava_after_main_menu', 'ava_after_main_container_mod', 10 );
    function ava_after_main_container_mod() {
    if( !is_single(array(15255)) || is_archive() || is_tag() ) return;
    	$output  = '';
    	$output .= do_shortcode("
    [av_section min_height='custom' min_height_px='100px' padding='no-padding' shadow='no-border-styling' bottom_border='no-border-styling' bottom_border_diagonal_color='#333333' bottom_border_diagonal_direction='' bottom_border_style='' custom_arrow_bg='' id='bback' color='main_color' background='bg_color' custom_bg='#32a5d2' background_gradient_color1='' background_gradient_color2='' background_gradient_direction='vertical' src='' attachment='' attachment_size='' attach='scroll' position='top left' repeat='no-repeat' video='' video_ratio='16:9' overlay_opacity='0.5' overlay_color='' overlay_pattern='' overlay_custom_pattern='' av_element_hidden_in_editor='0' av_uid='av-32zbqxs' custom_class='']
    
    [av_textblock wrapper_element='' wrapper_element_attributes='' av_uid='av-2gpcv34' custom_class='']
    [av_sidebar widget_area='HAMBURGUER' av_uid='av-bm8mys']
    <div class='centrotitulo'>[page_title]</div>
    [/av_textblock]
    [/av_section]
    [av_hr class='invisible' height='100' shadow='no-shadow' position='center' custom_border='av-border-thin' custom_width='50px' custom_border_color='' custom_margin_top='30px' custom_margin_bottom='30px' icon_select='yes' custom_icon_color='' icon='ue808' font='entypo-fontello' custom_class='ajuste-espaco' admin_preview_bg='' av_uid='av-1ofdwyo']
    
    ");
    	echo $output;
    }
    
    #987900

    Hey CloudChoice,

    You are excluding the category and the tags in the code above.

    if( !is_single(array(15255)) || !is_archive() || !is_tag() ) return;

    Try using the code like this.

    Best regards,
    Victoria

    #987916

    Hi Victoria,

    Thanks for the quick reply. Unfortunately it did not work.

    if( !is_single(array(15255)) || is_archive() || is_tag() ) return;only works on posts

    if( !is_single(array(15255)) || !is_archive() || !is_tag() ) return;does not work in any

    Any other tips?
    Thank you

    #987975

    Hi,

    The conditionals “is_archive()” or “is_tag()” will return on all tag or category archive pages. Combined with the command return your code will not fire. If you want to execute the code below this line on archive/tag pages too simply replace:

    
    if( !is_single(array(15255)) || is_archive() || is_tag() ) return;
    

    with

    
    if( is_single() && !is_single(15255) ) return;
    

    Best regards,
    Dude

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.