WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
[resolved] Customizr Slider with Sidebar (18 posts)

  1. lozadaOmr
    Member
    Posted 8 months ago #

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

  2. tomaja
    Member
    Posted 8 months ago #

    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.

  3. lozadaOmr
    Member
    Posted 8 months ago #

    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);

  4. tomaja
    Member
    Posted 8 months ago #

    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.

  5. lozadaOmr
    Member
    Posted 8 months ago #

    @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(http://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

  6. tomaja
    Member
    Posted 8 months ago #

    @lozadaOmr - check the image url, it seems that image is not accessible

  7. lozadaOmr
    Member
    Posted 8 months ago #

    I have checked it and it is accessible.

  8. nikeo
    Member
    Theme Author

    Posted 8 months ago #

    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!

  9. lozadaOmr
    Member
    Posted 8 months ago #

    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)

  10. tomaja
    Member
    Posted 8 months ago #

    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

  11. lozadaOmr
    Member
    Posted 8 months ago #

    @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?

  12. lozadaOmr
    Member
    Posted 8 months ago #

    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?

  13. lozadaOmr
    Member
    Posted 7 months ago #

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

    Thank you @tomaja , @nikeo

  14. nikeo
    Member
    Theme Author

    Posted 7 months ago #

    Ok fine, thanks for your feedback on this.

  15. marcuse_alfa
    Member
    Posted 6 months ago #

    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:
    http://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

  16. ElectricFeet
    Member
    Posted 6 months ago #

    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.

  17. marcuse_alfa
    Member
    Posted 6 months ago #

    Sorry, I will.
    In any case, your answer is not for my case, because I need the slider after the title.

    Regards.

  18. MotoAccademia
    Member
    Posted 6 months ago #

    Hello marcuse_alfa!

    This is my solution to position the Slider immediately below the title of the Page/Post and immediately before the Content.

    //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() {
    /* Applico solo se si tratta di una pagina e non รจ la HomePage */
    	if(!is_home() && is_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( '__before_content' , array( TC_slider::$instance , 'tc_slider_display' ), 10);
    		}
    }

    The trick is to play with the priorities of the action that you are entering in the chain of events "__before_content".
    It is sufficient to use a lower priority to 0, in my case I used 10, and your action is executed at the appropriate time.

    Note: In this case I wanted the slider was always after the title of the pages or posts.
    On the home page, however, I want to keep the slider in the standard position!

    Try it and you'll see that it works!

    Bye-bye!

Reply

You must log in to post.

About this Theme

About this Topic