X Theme: Above Masthead

We can select to have a slider above the masthead. Does X Theme allow to place a block of content above the slider? I would like to have a countdown above the slider.

Hi There,

To achieve that, you have to setup a child theme:

After that add this custom code under functions.php file locates in your child theme:

/* this code is used for print the countdown above masthead */

add_action( 'x_before_view_global__slider-above', 'x_print_count_down_above' );
function x_print_count_down_above(){
	echo do_shortcode( '[your-count-down-shortcode]' );
}

/* this code is used for print the countdown below masthead */

add_action( 'x_before_view_global__slider-below', 'x_print_count_down_below' );
function x_print_count_down_below(){
	echo do_shortcode( '[your-count-down-shortcode]' );
}

Hope it helps :slight_smile:

Thank you. I create pages using Elementor. There isn’t a shortcode, but an element block we use to place a countdown timer. I noticed the PHP code needs a shortcode.

  1. Can I edit most of my page using Elementor but also edit with Cornerstone (so I can get a shortcode for a countdown)?

  2. Can I create a countdown in Cornerstone for the shortcode without editing the page?

  3. If not, what do you suggest?

Hello Jason,

Thanks for updating in!

  1. It is not recommended that you switch between editors. If you edit your page with Elementor, stay with Elementor. And if you would like to edit the page with Cornerstone, use only Cornerstone to edit your page.

  2. We are not sure which countdown shortcode you are referring. If you are using Cornerstone, then you should be able to use the Classic Counter element. And if not, then you can also use the Classic Counter shortcode which you can found a demo here: http://demo.theme.co/integrity-1/shortcodes/counter/

Hope this helps.

I am using Elementor’s countdown because I edit with Elementor. The countdown allows for a redirect to a page after the countdown has ended. If I place:

add_action( ‘x_before_view_global__slider-above’, ‘x_print_count_down_above’ );
function x_print_count_down_above(){
echo do_shortcode( ‘[your-count-down-shortcode]’ );
}

…in my functions.php page, then it adds the countdown to the redirected page. When it redirects to the redirect page, the redirect page has the countdown timer and then redirects to the redirect page over and over. It’s an endless loop.

Question: How do I exclude the redirect page from having the countdown timer placed above the masthead?

Hello Jason,

To resolve this, please get the page ID of your redirect page. To know how you can get the ID, please check this first:

And then you must update the code:

add_action( 'x_before_view_global__slider-above', 'x_print_count_down_above' );
function x_print_count_down_above(){
    if ( !is_page(123)) {
        echo do_shortcode( '[your-count-down-shortcode]' );
    }
}

We are using !is_page(123) which means “Not page 123” where 123 is the page ID of the redirect page.

We would loved to know if this has work for you. Thank you.

Perfect! Thank you very much!

Glad to know!

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.