Support » Fixing WordPress » Create an "if mobile/table then echo" php for website.

  • Resolved kmurrayfrgraphics


    There is a specific page on my website that when a person is viewing it through a phone or tablet I want it to say:

    “Click for more information”

    This is because the way my responsive java works when you hover over and object on the computer it pops up information, but on the mobile and tablet site you need to “click” on it to show the information.

    I figured it would be a php solution as an “if screen resolution = x then echo “Click for more information”

    I am not sure if I am in the right direction or if there would probably be a java solution.

    If anyone could help that would be awesome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You should use css media queries for this.

    You should create a button that is only displayed on tablets and phones. Look at the css below. Add the class “.hidden-desktop” to the button, and it will only show on tablets and phones. Then you shuould use javascript to show the content when this button is clicked.

    .hidden-desktop    { display: none !important; }
    // Phones only
    @media (max-width: 767px) {
        .hidden-desktop    { display: inherit !important; }
    // Tablets & small desktops only
    @media (min-width: 768px) and (max-width: 979px) {
        .hidden-desktop    { display: inherit !important; }

    could I do this with a div?

    I can, thank you very much, great solution!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create an "if mobile/table then echo" php for website.’ is closed to new replies.