• 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 (or before the title), 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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!

    Excuse me.
    I replied in the thread that had been reported as solved …
    I copied my solution here …

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customiz'it: how to embed a slider inside a page or an article (after the title)’ is closed to new replies.