i'm using the BAAP Mobile version plugin and the footer link that switches between desktop and mobile version is being displayed outside of the wrapper>footer divs. Is there a hook or a method to have the switcher link display in the footer section?

This is the function that creates and displays the links in the wpmp_switcher.php file.

function wpmp_switcher_wp_footer($force=false) {
  if(!$force && (get_option('wpmp_switcher_mode')=='none' || get_option('wpmp_switcher_footer_links')!='true')) {
  switch (wpmp_switcher_outcome()) {
      print wpmp_switcher_link('desktop', __('Switch 2 our desktop site', 'wpmp'));
      print "<p>" . wpmp_switcher_link('mobile', __('Switch to our mobile site', 'wpmp')) . "</p>";
  • You don't need a hook, just call wpmp_switcher_wp_footer function in tthe right place.
    – Bainternet
    May 17 '11 at 5:45
  • But the above code displays the link by itself, and if the function is called, then it would display links in both footer and at the end of the wrapper tags. so what would be the right way to have the link show up only in the footer section?
    – Sledge81
    May 17 '11 at 5:48
  • Got it.. I had to comment out this line of code add_action('wp_footer', 'wpmp_switcher_wp_footer');
    – Sledge81
    May 17 '11 at 5:56
  • commenting out the code will be bad because next plugin update its back , better use remove_action.
    – Bainternet
    May 17 '11 at 6:09

If you look in the plugin's directory plugins/wpmp_switcher/wpmp_switcher.php on line 53 you will see this:

add_action('wp_footer', 'wpmp_switcher_wp_footer');

so you can either remove this action and call it in your theme your self with:

remove_action('wp_footer', 'wpmp_switcher_wp_footer');

or you just make sure that wp_footer(); is inside your wrapper>footer divs.

  • Yep got it. Seems pretty simple now that i've done it :) Thanks
    – Sledge81
    May 17 '11 at 6:01
  • Glad you got it.
    – Bainternet
    May 17 '11 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.