Okay
  Public Ticket #143190
php function for phone number
Closed

Comments

  • Bill started the conversation
    I'm about ready to take my site live. The last step is to add the phone numbers. Our contact phone numbers are generated by a function ifbyphone() I've added to the functions.php page. The ifbyphone() echos the phone number. I'd like post this to the call to action and the phone number in the header. It looks like I'm going to have to add this function to the theme. Can you tell me where in the theme these two locations exist ? Thanks, Bill Kellaway PS you have already helped once on this site. Thank you very much.
  • Bill replied

    I figured it out ..  header.php line 163 and footer.php line 31

     

     

  • Bill replied

    .. and functions.php lines 1142 - 1146

  •  1,070
    ThemeNectar replied

    Hey Bill - i'm very glad you sorted it :)

    Thanks for following back up for others who may read this!

    Cheers

  • Bill replied

    Thanks .. 

  • Bill replied

    Okay I'm trying to make this work with shortcodes because when I upgrade the theme the functions.php gets overwritten.

    I've put the same function into a very simple plugin. This plugin returns the phone number.

    Initially the shortcode would not work in the nav bar but I fixed that by adding to the plugin:

    add_shortcode( 'ifbyphone_number', 'ifbyphone' );
    function do_menu_shortcodes( $menu ){
    return do_shortcode( $menu );
    }
    add_filter('wp_nav_menu', 'do_menu_shortcodes');

    The issue I'm having now is that I cannot set a mail link for the top nav phone number. Example: tel:800-555-1212

    I figured our that the during the post process the shortcode brackets were being stripped ([ifbyphone_numer] became ifbyphone_number ) so I added the shortcode brackets in directly to the database.

    Any help on the telephone link / shortcode issue is appreciated.

    Also - on that issue - I cannot add the shortcode to the Call to Action.

    I've reviewed the vc_wp_custommenu.php page and have tried:

    add_filter('vc_wp_custommenu', 'do_menu_shortcodes'); with no luck.

    I know this may beyond your usual scope.

    Thank you,

    Bill