Support » Plugin: Mobile Content » Proper use in template

  • Resolved thorstone137

    (@thorstone137)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dylanfeltusdesign

    (@dylanfeltusdesign)

    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

    Plugin Author dylanfeltusdesign

    (@dylanfeltusdesign)

    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.

    Plugin Author dylanfeltusdesign

    (@dylanfeltusdesign)

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Proper use in template’ is closed to new replies.