简体   繁体   中英

Prestashop 1.7 hide content on mobile

In prestashop 1.7 how can I show/hide custom content (images, html blocks etc), specifically for mobile devices? Does this use smarty (or php) in tpl files?

You can use MobileDetect library:

public function hookDisplayHeader() 
{
    if (Context::getContext()->getMobileDevice()) {
        //content for mobile devices
    } else {
        //content for not mobile devices
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM