SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2010
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    wp mobile detector plugin help - custom page templates

    i'm using wp mobile detector by websitez.com on a test site to get it figured out before i launch to the live site and add it to others.

    the plugin makes it very easy to make a site mobile, however the support for the plugin is very lackluster and they haven't gotten back to me in a week now about this question:

    I’d like to put a “Contact Us” button at the bottom of all my pages EXCEPT my Contact Us page. I know that I can place this code in the page.php file. But it will get applied to every page. So how do I create CUSTOM PAGE TEMPLATES, just like would with a regular non-mobile theme, that I only want applied to certain pages of the site?

    please advise. thanks in advance.

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,833
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Did you try testing for the name of the page and if the name of the page is "contact us", not displaying the button? This shouldn't be hard to do, if I understand you correctly.

  3. #3
    SitePoint Addict
    Join Date
    May 2010
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you are suggesting I use CSS display:none; (though I'm not sure if that's what you're suggesting) I'd like to avoid that.

    I did hear back from the plugin creators finally. They said...

    you don't need custom page templates. What you want is a conditional. Whatever the slug is for your "Contact Us" page, such as "contact-us".

    You'd put something in the page.php like this:

    Code:
    if(!is_page('contact-us')):
     
    endif;
    This will only show on pages that aren't the contact us page.


    However, I'm not a PHP pro and unclear about how i implement that code in page.php.

    Let's say the button was in a div that looked like this:
    Code:
    <div id="contact"><a href="/contact-us"><img src="/wp-content/uploads/button.jpg" alt="contact button" /></a>
    ...how would I incorporate that into this code?
    Code:
    if(!is_page('contact-us')):
     
    endif;
    please advise. thanks in advance!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •