<?php
// [desktoponly] shortcode
add_shortcode('desktoponly', 'wp_snippet_desktop_only_shortcode');
function wp_snippet_desktop_only_shortcode($atts, $content = null){
if( !wp_is_mobile() ){
return wpautop( do_shortcode( $content ) );
} else {
return null;
}
}
// [mobileonly] shortcode
add_shortcode('mobileonly', 'wp_snippet_mobile_only_shortcode');
function wp_snippet_mobile_only_shortcode($atts, $content = null){
if( wp_is_mobile() ){
return wpautop( do_shortcode( $content ) );
} else {
return null;
}
}
?>
Now, we can wrap any text that should only be visible in the mobile browser with the shortcode [mobileonly][/mobileonly].
Example:
[mobileonly] This is a mobile only text. [/mobileonly]
Similar patterns apply to the desktop-only version as well.
Example:
[desktoponly] This is a desktop only text. [/desktoponly]
Video: Showing WordPress Mobile Only Content Using Plugin
Source link
Related posts:
1 Rajab Mubarak
A new look at effective career guidance
The Most Valuable Digital Marketing Skills in 2022 (That Every Company Is Looking For)
Characteristics and Evolution of Big Data
Mutual Fund types, Debt, Equity, Balanced, Tax Saving, Offshore Fund
Top Careers in Marketing (Highest Paying Digital Marketing Skills In 2022)
Changing face of Education Marketing | Digital Marketing Company in Delhi India - SEO, PPC, SMO, SE...
WordPress – Fout bij het maken van de databaseconnectie – oplossing
Article Published in the Harvard Business Review Special Issue November 2022
Bản cập nhật Link Spam và nội dung hữu ích tháng 12 vẫn đang triển khai
Digital Marketing Full Course 2022 | Digital Marketing Course | Digital Marketing | Simplilearn
The 12 Vital Disciplines of Top Digital Marketers | Cooler Insights