• Resolved lozadaOmr

    (@lozadaomr)


    Is it possible to put the Customizr slider in between the two Sidebars (using a Left & Right sidebar pagelayout)?

Viewing 15 replies - 1 through 15 (of 17 total)
  • tomaja

    (@tomaja)

    You can use this snippet, just replace
    add_action( '__header' , array( TC_slider::$instance , 'tc_slider_display' ), 0);
    with
    add_action( '__loop' , array( TC_slider::$instance , 'tc_slider_display' ), 0);
    but you then must adjust slider witdh (and height) to fit that narrow space between two sidebars.

    Thread Starter lozadaOmr

    (@lozadaomr)

    In which file should I edit this?

    I can’t seem to find the line of code

    add_action( '__header' , array( TC_slider::$instance , 'tc_slider_display' ), 0);

    tomaja

    (@tomaja)

    As I said, follow the instructions in the snippet. Line you need to change is in the snippet code that you need to put in functions.php file of your child theme.

    Thread Starter lozadaOmr

    (@lozadaomr)

    @tomaja ,
    I followed the instructions for the snippet.
    You are correct, I still need to make some tweaks on the CSS, to make it fit in the narrow content area between two sidebars, but I am now getting a warning.
    Child Theme’s functions.php

    <?php
    //we hook the code on the wp_head hook, this way it will be executed before any html rendering.
    add_action ( 'wp_head' , 'move_my_slider');
    function move_my_slider() {
        //we unhook the slider
        remove_action( '__after_header' , array( TC_slider::$instance , 'tc_slider_display' ));
    
        //we re-hook the slider. Check the priority here : set to 0 to be the first in the list of different actions hooked to this hook
        add_action( '__loop' , array( TC_slider::$instance , 'tc_slider_display' ), 0);
    }
    ?>

    Unfortunatly, I am getting an warning because of this,

    Warning: getimagesize() [function.getimagesize]: Couldn’t resolve host name in /home/sushidel/public_html/wp-content/themes/customizr/parts/class-header-header_main.php on line 145

    Warning: getimagesize(https://www.sushidelivery.com.ph/wp-content/uploads/2013/11/gryn-logo2.png) [function.getimagesize]: failed to open stream: operation failed in /home/sushidel/public_html/wp-content/themes/customizr/parts/class-header-header_main.php on line 145

    tomaja

    (@tomaja)

    @lozadaomr – check the image url, it seems that image is not accessible

    Thread Starter lozadaOmr

    (@lozadaomr)

    I have checked it and it is accessible.

    Theme Author presscustomizr

    (@nikeo)

    Hi @lozadaomr, you might want to use the __before_loop hook to do that :

    add_action ( 'wp_head' , 'move_my_slider');
    function move_my_slider() {
        //we unhook the slider
        remove_action( '__after_header' , array( TC_slider::$instance , 'tc_slider_display' ));
    
        add_action( '__before_loop' , array( TC_slider::$instance , 'tc_slider_display' ), 0);
    }

    About the get_image_size issue, it should not be related to this code. and it is tested with @ before being executed (@supresses any error reporting output mail might produce) => you should not see this warning. weird.
    hope this will helps anyway!

    Thread Starter lozadaOmr

    (@lozadaomr)

    The warning I got was weird, it’s gone now. weird.

    So after doing some testing, I managed to make the slider work I tested it here and it works fine.

    But when I try to do it on the Front (home), the slider doesn’t appear?
    Why is that? Do I still need to put additional codes?

    It was supposed to appear above the Inquire Now button.
    (Still between the two sidebars)

    tomaja

    (@tomaja)

    Thanks @nikeo, I was just about to make that correction too, wild thing on post lists with __loop only ??
    @lozadaomr did you actually set any slider for front page ? It is working on my test site

    Thread Starter lozadaOmr

    (@lozadaomr)

    @tomaja Yes I did, although I’m just guessing it could be because I am using a static page to display the post and front page?

    Thread Starter lozadaOmr

    (@lozadaomr)

    Good day,
    I did some more testing, but I can’t get it right.

    This is the page where I tested my Slider, it works fine. It’s called test-page.

    So I then change my front page settings, using the test-page as my front page. I was expecting it to work, but still the slider also didn’t work?

    Thread Starter lozadaOmr

    (@lozadaomr)

    I have reverted my front page to displaying the latest post, and it worked from there on.

    Thank you @tomaja , @nikeo

    Theme Author presscustomizr

    (@nikeo)

    Ok fine, thanks for your feedback on this.

    Hi Nikeo,

    first of all, compliments for your beautiful theme.

    I’m trying to use your snippet on a normal page of my website. I’m trying (without succeeding) to put the slider inside the body of the page, meaning after the title, embedded in the body of the page.
    At this time, I’m only able to see the slider after the body of the page, as shown here:
    https://hotel.moltosenso.it/accessori-per-le-camere/tv/

    May you help me, please? I’m acting with the re-hook solution as a filter that acts before the page load, but I guess there is also a way to show the slider as a page content, isn’t there?

    I’m pasting here the snippet, as it is now:

    add_action ( ‘wp_head’ , ‘move_my_slider’);
    function move_my_slider() {
    $page_id = 25;
    if (is_page($page_id)) { //we use the slider in this way only for that specific page
    //we unhook the slider
    remove_action( ‘__after_header’ , array( TC_slider::$instance , ‘tc_slider_display’ ));

    //we re-hook the slider. Check the priority here : set to 0 to be the first in the list of different actions hooked to this hook
    add_action(‘__after_main_container’ , array( TC_slider::$instance , ‘tc_slider_display’ ), 0);
    }}

    Do you find anything to change in order to obtain what I need? Or do you have another solution?

    Thank you so much!

    Kind regards,
    Marco

    1. You should open your own thread. It’s a different problem to the one that opened thread.
    2. Place code in backticks, otherwise you risk breaking the this forum’s thread’s page.

    The nearest easy way to add a slider to the top of the page is to edit the page and select “Yes” to “Add a slider to this post/page“. This puts it above the title.

    Please open a new thread for your problem if you still need help.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Customizr Slider with Sidebar’ is closed to new replies.