WordPress.org

Ready to get started?Download WordPress

Forums

Mobile Content
[resolved] Proper use in template (4 posts)

  1. thorstone137
    Member
    Posted 1 year ago #

    Hello. I really like this!

    I wanted to include this php isMobile() && ! $detect->isTablet() ) { echo "Content here";// Code to run Mobile Content } ?> you provided in my templates..

    For example, if I wanted to sidebar content to be device specific, how who you recommend integrating this code? Can I add shortcodes, php, or html to the "Content here"?

    isMobile() && ! $detect->isTablet() ) { echo "Can I add any content here? Like more shortcodes or php?";// Code to run Mobile Content } ?>

    http://wordpress.org/extend/plugins/mobile-content/

  2. dylanfeltusdesign
    Member
    Plugin Author

    Posted 1 year ago #

    Ok so you want to have different sidebars? Or have different HTML?
    Can you explain with a little more detail? Or provide a link so I can see what you mean.

    Looking back at this code I provided I notice it is incomplete... i will get the right code

  3. dylanfeltusdesign
    Member
    Plugin Author

    Posted 1 year ago #

    Here is the correct code. With my plugin installed this will work when you place it in the template files. This code will show "Content here" to users on Tablets & Desktops.

    <?php
    require_once 'wp-content/plugins/mobile-content/mobile-detect.php';
    $detect = new Mobile_Detect();
    
    					if( ! $detect->isMobile() || $detect->isTablet() ){
    						echo "Content here";// Code to run Tablet & Desktop but not Mobile
    }
    			?>

    Please let me know more details about your specific needs.

  4. dylanfeltusdesign
    Member
    Plugin Author

    Posted 1 year ago #

    I am going to mark this as resolved.... Please let me know if you have further issues with the plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.