WordPress support from our community
Testing Code on a Mobile Device
June 18, 2012 at 10:09 pm #1467
I had a web developer help me out yesterday by placing code in my theme files so I could end each post with Follow Me buttons (Facebook, Twitter, Pinterest and RSS). The buttons are aligned in a horizontal row with links by using Shortcode at the end of each post which he wrote for me.
Thought all was good but when I went to view the blog post on my IPhone late last night the shortcode was displayed as text in the blog post and all my social media icons were NOT on the post.
When I view the post on an IPad 3 the buttons are aligned left and touching each other.
Only on my Mac using Safari does everything look correct.
Here is an example of the buttons in a post:
How do I change the code so my red signature and the 4 buttons show up when viewing blog posts on a mobile device? Besides the obvious of owning a smartphone is there a way to “test” code to see what will happen when it is viewed on a mobile device? A plug-in that mirrors a mobile phone?
Sheryl B.June 19, 2012 at 12:43 am #2517Margarete KoenenParticipant
Did you get this fixed? It looked perfect in Chrome, Opera,on my ipad 2 and a mobile phone simulator.June 19, 2012 at 3:11 am #2518
My IPhone is still showing only the short code as text – No red signature or gray social media buttons showing
ThanksJune 19, 2012 at 2:00 pm #2519
@Sheryl– Looks fine on my iPhone.Social buttons are a little tight, but the rest looks fine.June 19, 2012 at 6:02 pm #2520
@Steve – How can that be? I am looking at the post on an IPhone 4 and the short code , [social media], is in text at the end of the post? I do not see my red signature or any buttons.
Are you on a 4S?June 19, 2012 at 6:56 pm #2521amylaneioSpectator
I see it on my iPhone too, Steve. Look right above the related posts at the bottom of the page. Looks like Sheryl’s using a mobile theme that doesn’t read the short code.June 19, 2012 at 7:10 pm #2522
I see it now! Sorry…
Andrew is probably correct. Your main theme supports this [social-media] shortcode, and the mobile theme does not.
The easiest route is to find the shortcode code in your main theme. Look for the add_shortcode function… probably in functions.php. Copy that code, and make your own plugin with it. Since plugins run for all themes, this would work.
I know writing your own plugin may be scary, but it’s really not that bad. If you can find the shortcode code and post it on this site, we can help you write it.June 19, 2012 at 8:20 pm #2523
OK HERE IS THE CODE COPIED FROM MY FUNCTIONS.PHP THEME FILE:
/* Add the main siteadmin menu item */
$wp_admin_bar->add_menu( array( ‘id’ => ‘theme_options’, ‘title’ => THEME_NAME, ‘href’ => admin_url(‘themes.php’).”?page=”.THEME_FILE ) );
$wp_admin_bar->add_menu( array( ‘parent’ => ‘theme_options’, ‘title’ => __( ‘Layout Options’, ‘magazine-basic’ ), ‘href’ => admin_url(‘themes.php’).”?page=”.THEME_FILE ) );
add_action( ‘admin_bar_menu’, ‘add_menu_admin_bar’, 70 );
DID I COPY THE CORRECT CODE FOR YOU TO HELP ME OUT?? Also can you change the code so the words FOLLOW ME are not as large in pixel size and take the : off after the words?
Thanks so much!!!!
SherylJune 19, 2012 at 8:22 pm #2524
@Steve – I do not know how to prevent the code I paste from converting into images and just remain as code — Sorry…….June 19, 2012 at 8:46 pm #2525June 19, 2012 at 9:01 pm #2526
I signed up for an account at Pastebin as username SBlasnik
Here is the URL after I pasted the code from my Functions.php file
I labeled it as private members only and used the name Fashion Development Group for the Paste.
Hopefully I did this correctly – ThanksJune 21, 2012 at 12:25 am #2527
@Sheryl– the code snippet needs to be PUBLIC not Private. If you just post the add_shortcode(‘social-media’, ‘addSocialMedia’) and the addSocialMedia function that should not be an issue.June 21, 2012 at 12:37 am #2528
OK — I pasted it with the setting of Public
Is that all you need to view it?June 21, 2012 at 12:50 am #2529
- You must be logged in to reply to this topic.