[Support request] code sinppet is valid only for the right sidebar

Home Forums Support [Support request] code sinppet is valid only for the right sidebar

Home Forums Support code sinppet is valid only for the right sidebar

  • This topic has 3 replies, 2 voices, and was last updated 2 years ago by Fernando.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2178050
    Yassine

    Hi,

    This code sinppet bellow is valid only for the right sidebar, How to apply it for the left sidebar

    add_action(‘generate_before_comments’, ‘inser_sidebar_before_comment’);
    function inser_sidebar_before_comment() {
    if ( is_single() && wp_is_mobile() ) {
    return get_sidebar();
    }
    }

    #2178096
    Fernando
    Customer Support

    Hi Yassine,

    Can you try this for the left sidebar instead?:

    add_action('generate_before_comments', 'inser_sidebar_before_comment');
    function inser_sidebar_before_comment() {
    if ( is_single() && wp_is_mobile() ) {
    return get_sidebar( 'left' );
    }
    }

    If you wish both to appear there, you can try:

    add_action('generate_before_comments', 'inser_sidebar_before_comment');
    function inser_sidebar_before_comment() {
    if ( is_single() && wp_is_mobile() ) {
    return get_sidebar( 'left' ) + get_sidebar();
    }
    }

    Kindly let us know how it goes. 🙂

    #2178100
    Yassine

    Thanks, Its worked : )

    #2178135
    Fernando
    Customer Support

    You’re welcome Yassine! Glad that worked! Feel free to reach out anytime you’ll need assistance with anything else. 🙂

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