dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasfind.mobiInstant Mobilizer

Posted by geoster 24 weeks 1 day ago

pic
 geoster
mobiForge Newbie
Posts: 2
Joined: 24 weeks ago
[offline]

Where does this code get written? The switcher is showing up fine on the mobile theme, but on my desktop theme it is writing it to the body tag so it is floating over other parts of my site. I looked through the theme and plug-in files but couldn't find out where you call the switcher to make sure it is called in the footer.

My site is not public so I can't show you, but here is the page source where this is showing. I am using the Hybrid News theme.

	<div id="footer-container">
		<div id="footer">
			Copyright 2009, All Rights Reserved.
		</div><!-- #footer -->
	</div><!-- #footer-container -->
</div><!-- #body-container -->
<script type='text/javascript' src='/wp-content/plugins/contact-form-7/contact-form-7.js?ver=2.0.5'></script>
<a onclick='document.cookie="wpmp_switcher=mobile;path=/;expires=Tue, 01-01-2030 00:00:00 GMT";' href='/company/?wpmp_switcher=mobile'>Switch to our mobile site</a>
</body>

Notice it is right before the /body tag, and after the body and footer containers...

Suggestions on where to look?

Thanks!

Posted by geoster 22 weeks ago

pic
 geoster
mobiForge Newbie
Posts: 2
Joined: 24 weeks ago
[offline]

I've narrowed this down to a compatibility issue with the theme I'm using: Hybrid News. Where should I edit my theme to make sure it pulls in the wp_footer/wpmp_switcher_wp_footer correctly?

Posted by gnarzilla 17 weeks ago

pic
 gnarzilla
mobiForge Newbie
Posts: 2
Joined: 18 weeks ago
[offline]

I'm having the same problem as described above. The WordPress Mobile Pack is a great plug-in and works really well in almost all regards. However, just one tiny thing. When detecting a desktop, the switcher code does correctly create a link in the desktop version of the site to allow the user to "switch to our mobile site." However, instead of appearing in the footer, this link appears on the outside of the body container for the site. Does anyone know which portion of code should be edited to rectify this problem?

We're a non-profit trying to work on a shoestring budget and, as you can probably tell, not experts on coding. So, thanks in advance for your help!

Posted by meier 17 weeks ago

pic
 meier
mobiForge Enthusiast
Posts: 10
Joined: 20 weeks ago
[offline]

As far as I understand it, it is generated by the wp_footer() php function
Typically you find it in the footer.php file of your theme.

If you have a theme with a fixed width, the switcher often flows to right of the main area at the top.
You can add a
<div style="clear: both"> ... </div>
to the footer.php to make sure it goes to the button.

Hope this helps

Karsten Meier

--
Karsten Meier
Handylearn Projects creates mobile software.
www.handylearn-projects.de

-- Karsten Meier Handylearn Projects creates mobile software. www.handylearn-projects.de

Posted by gnarzilla 16 weeks ago

pic
 gnarzilla
mobiForge Newbie
Posts: 2
Joined: 18 weeks ago
[offline]

Thanks... as it turned out, the code was in a file named wpmp_switcher.php

It appeared as follows, and I was able to adjust it to get it to stop printing just outside the container

function wpmp_switcher_wp_footer($force=false) {
  if(!$force && (get_option('wpmp_switcher_mode')=='none' || get_option('wpmp_switcher_footer_links')!='true')) {
    return;
  }
  switch (wpmp_switcher_outcome()) {
    case WPMP_SWITCHER_MOBILE_PAGE:
      print wpmp_switcher_link('desktop', __('Switch to our desktop site'));
      break;
    case WPMP_SWITCHER_DESKTOP_PAGE:
      print wpmp_switcher_link('mobile', __(''));
      break;
  }

Thanks for the help!

Posted by ParanoidSardine 16 weeks ago

pic
 ParanoidSardine
mobiForge Newbie
Posts: 1
Joined: 16 weeks ago
[offline]

I've been working on this same problem. Your solution kinda works in that it gets rid of the ugly text outside of the footer, but I wanted to move that text to inside the footer. The template I'm using had a footer.php file that looked like:

	<div id="footer" class="fix">
                   ...more code
	</div>
</div>
<script src="<?php bloginfo('template_url') ?>/js/functions.js" type="text/javascript" charset="utf-8"></script>
<?php wp_footer(); ?>
</body>
</html>

Note that <?php wp_footer(); ?> is called outside of the div with id="footer". As such, the code for this plugin was rendered outside of the footer giving us the ugly text. By moving the wp_footer() function call inside the footer div, the text was rendered inside the footer div.

	<div id="footer" class="fix">
                   ...more code
	        <?php wp_footer(); ?>
        </div>
</div>
<script src="<?php bloginfo('template_url') ?>/js/functions.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

Now, I imagine that this might mess up how other plugins that write to the footer render. In my case, this is not a problem, so this solution works for me.

Also, I need to change the text that was rendered in order to be able to hook on to it with css. To accomplish this, I altered line 386 in wpmp_switcher.php. This allow me to change up the link attributes. Then, following your gnarzilla's suggestion, I altered the displayed text in the function starting on line 190 of this same file.

Without you pointing out where this logic was occurring, I would not have been able to make these modifications. Thanks gnarzilla!