如何只在wordpress博客首页显示智能滑块
How to show smart slider only on home page of wordpress blog
我在 WordPress 中使用 Astra 主题和 Smart Slider 3 插件。我使用 Astra Hooks 插件在 header 上显示滑块并且它有效但滑块显示在所有页面上。
如何让滑块只出现在主页 header 上?
wordpress 有 conditional tags 来处理这些问题。
我没有使用 astra hooks 插件,您可以使用下面的代码片段并将其粘贴到子主题的 functions.php 文件中。将滑块的简码替换为 [shortcode_of_your_slider]
就可以了。
如果您想更改滑块结帐的位置 astra visual hooks。现在我正在使用 astra_header_before
你不能随心所欲地改变它
add_action( 'astra_header_before', 'shalior_display_header_on_front_age' );
function shalior_display_header_on_front_age() {
if(is_front_page()){
echo do_shortcode('[shortcode_of_your_slider]');
}
}
我在 WordPress 中使用 Astra 主题和 Smart Slider 3 插件。我使用 Astra Hooks 插件在 header 上显示滑块并且它有效但滑块显示在所有页面上。
如何让滑块只出现在主页 header 上?
wordpress 有 conditional tags 来处理这些问题。
我没有使用 astra hooks 插件,您可以使用下面的代码片段并将其粘贴到子主题的 functions.php 文件中。将滑块的简码替换为 [shortcode_of_your_slider]
就可以了。
如果您想更改滑块结帐的位置 astra visual hooks。现在我正在使用 astra_header_before
你不能随心所欲地改变它
add_action( 'astra_header_before', 'shalior_display_header_on_front_age' );
function shalior_display_header_on_front_age() {
if(is_front_page()){
echo do_shortcode('[shortcode_of_your_slider]');
}
}