Smart Slider 3メモ
Smart Slider 3でPC用とスマホ用画像を分けたい
子テーマの「functions.php」に以下のコードを記述します。
https://show-be.net/wordpress/676/
//PCでのみ表示するスライドショー
function
if_is_pc($atts, $content
= null )
{
$content
= do_shortcode( $content);
if(!is_mobile())
{
return
$content;
}
}
add_shortcode('pc', 'if_is_pc');
//スマートフォンでのみ表示するスライドショー
function
if_is_mo($atts, $content
= null )
{
$content
= do_shortcode( $content);
if(is_mobile())
{
return
$content;
}
}
add_shortcode('mo', 'if_is_mo');
そして、固定ページの記事内で使いたいところに以下のように記述します。
<!-- 条件分岐 --> <div class = "slider1" > [pc][smartslider3 slider=4][/pc] [mo][smartslider3 slider=5][/mo] </div> |