WordPress.org

Forums

WP Mobile Detect
[resolved] Using shortcode in header.php (5 posts)

  1. Ironstone
    Member
    Posted 2 years ago #

    I want to be able to use the [notphone] shortcode in the header.php to change the logo used depending upon if it's a phone or desktop/tablet.

    How can I do this? I'm trying to put it "around" this:

    <h1 id="logo"><?php echo $langcode; ?>"><?php bloginfo('name'); ?></h1>

    Many thanks.

    http://wordpress.org/extend/plugins/wp-mobile-detect/

  2. Ironstone
    Member
    Posted 2 years ago #

    Sorted this now.

  3. 7corvus7
    Member
    Posted 1 year ago #

    Hi,
    how did you solve that?
    can you post some code example of using [phone] [/phone] ?

    Thanks

  4. voldby
    Member
    Posted 1 year ago #

    Ironstone - what is the point of asking in a forum, post that you have figured it out yourself, and not posting the solution?

  5. mtuttle
    Member
    Posted 1 year ago #

    Here's how I got it to work for my theme, since the developer and the original poster seem checked out.

    <?php
        if (function_exists('wpmd_is_phone') && wpmd_is_phone()) {
            echo "<li><a class='phone' href='tel:" . ot_get_option('phonenumbercontent') . "'><span class='phone'>" . ot_get_option('phonenumbercontent') ."'</span></a></li>";
        } else {
            echo "<li><span class='phone'>" . ot_get_option('phonenumbercontent') . "</span></li>";
        }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Mobile Detect
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags