[resolved] Shortcode to switch content if mobile or desktop (8 posts)

  1. crashjohnson
    Posted 4 years ago #

    I'm looking for a plugin that would allow me to display different types of content if the user is visiting on a mobile device or if they are on a desktop. For example, I would like to display a flyer or picture on desktops but text description on mobile.

    For instance:

    [mobile]You are on a mobile device[/mobile]
    [not-mobile]you are NOT on a mobile device[/not-mobile]

    I found a plugin that claims to do just this. The problem is that it is, as of this writing, unavailable. Does anyone know of any others that may do this? acmeifmobile.com

    I would like to clarify that I am not looking for something that will display the same content in a mobile friendly way. I am looking, specifically, for something that will display entirely different contact in each environment.

  2. cubecolour
    Posted 4 years ago #

    Set up shortcodes in your functions.php or in a plugin to add an enclosing div around the content so you can designate it mobile or not-mobile - each with a class to enable it to be targeted with CSS. Then use media queries in your CSS & set each type of content to display or not as appropriate



  3. venicedesign
    Posted 3 years ago #

    @crashjohnson - did you ever find a plugin to do this?

  4. dylanfeltusdesign
    Posted 3 years ago #

    @crashjohnson @venicedesign - try my plugin Mobile Content

  5. dylanfeltusdesign
    Posted 3 years ago #

    you can do:

    [computer]Content for only computers here[/computer]
    [tablet]Content for only tablets here[/tablet]
    [mobile]Content for only phones here[/mobile]
    [mobile_tablet]Content for phones and tablets here[/mobile_tablet]
    [ios]Content for only iOS devices only here[/ios]
    [android]Content for only Android devices only here[/android]
    [bb]Content for only Blackberry devices here[/bb]
    [kindle]Content for only Kindle devices here[/kindle]

  6. der-mali
    Posted 3 years ago #

    Here is another one:

    "WP Mobile Detect"

    Impressing list of shortcodes:


    Well, I came to this thread because I need a similar solution:
    I want to do a selection of the content depending on the theme (e.g. theme 1 for desktop, theme 2 for mobile).


    Maybe it would be possible to add a function to one of the mentioned plugins which detects the theme and than filters the content!?

  7. dylanfeltusdesign
    Posted 3 years ago #

    @der-mall This is not something I would like to add to my plugin but if you email me I could certainly help you with this.

    My email is:

  8. crashjohnson
    Posted 3 years ago #

    As it turns out, for me, my theme was responsive and I can just modify some css to hid/unhide divs based on screen size.

    Thank you @ dylanfeltusdesign and @der-mali for your contributions. I'm sure this will help others in the future.

Topic Closed

This topic has been closed to new replies.

About this Topic