With all the rave for responsive designs going on, some folks like me still prefer a dedicated mobile website and if you’re using WordPress, there a lots of plugins you can install to mobilize your website in a matter of minutes. MobilePress is one of such plugins and I’ve been using it for a couple of years now. MobilePress is very flexible and that’s one thing I love about it; you can create your own theme and make your mobile website appear just the way you want. Using shortcodes on the mobile template is also possible if you know your way around it.
One of the setbacks is that unlike responsive designs, you cannot use widgets on MobilePress. If you rely a lot on widgets for a good user experience, you can easily add them to MobilePress by following the simple steps in this guide.
Using Widgets on MobilePress
– Download and install amr shortcode any widget plugin
– Go to Appearance > Widgets. You should now see a new widget area named Widgets for Shortcodes
– Drag the widgets you wish to show on MobilePress here. You can drag as many widgets as you want but it’s good to keep it minimal.
– In this tutorial, were using two widgets as examples: WordPress popular Posts and Recent Comments. Of course, you can add any widget you want.
– Note the names of the widgets as shown above.
– Now login to cPanel file manager and go to where your MobilePress theme is located.
For default theme: …/public_html/wp-content/plugins/mobilepress/themes/default
For custom theme: ……/public_html/wp-content/mobilepress/themes/theme_name
– Locate footer.php and edit
– On the very first line, you should use this shortcode to display recent comments:
<?php echo do_shortcode('[do_widget "recent comments" widget_classes=none title=true wrap=htmltag class=dcwidget]') ?>
</div>
-And to display WordPress Popular posts, use this:
<?php echo do_shortcode('[do_widget "wordpress popular posts" widget_classes=none title=true wrap=htmltag class=dcwidget]') ?>
</div>
The letters in red denote the name of the widgets I asked you to note earlier in the tutorial. You can change this to whatever you want so far the widget is placed in Widgets for Shortcodes widget area on your WordPress dashboard.
– For further customization, you can add this in your CSS file to style the widget:
border: 1px solid #DDD;
padding: 10px;
border-radius: 5px;
margin: 5px;
}
Instead of using the widget name in the shortcode, you can use the widget ID as explained by the plugin author on this page.
In this case, the code to use should look like this:
<?php echo do_shortcode('[do_widget "id=widget-id-here" widget_classes=none title=true wrap=htmltag class=dcwidget]') ?>
</div>
This is useful if the widget name won’t work and this happens in rare cases. It’s a great plugin that offers lots of possibility even if you’re just trying to display a widget on post pages or you’re trying to create a widgetized homepage for the full site.