In this tutorial, i’ll provide all the PHP & CSS code you can use to add your Twitter Follow Count Button In any StudioPress theme Navigation Menu.
The code works in either the primary or secondary nav menu and floats the button to the right by default.
It creates a widget area which you can use with a default WordPress text widget.
All you need to do is grab the Javascript code from the Twitter Developers website and paste it into your text widget.
Or use this code & change the Twitter handle:
Lifestyle Theme Secondary Nav Menu
Here’s what the button looks like in the secondary nav menu of the Lifestyle child theme by StudioPress.
Here’s the code:
Metro Theme Primary Nav Menu
The CSS is slightly different for each theme and in this case the button is displayed in the primary nav menu.
Here’s the PHP & CSS code.
Sample Theme Primary Nav Menu
Simply change the menu location in the PHP code from secondary to primary and vice versa.
Sample Theme Secondary Nav Menu
This code can be used in any StudioPress child theme and only requires changing of the margin: value; in the CSS code.
Hi Brad,
Just found your site and absolute love it. I’m trying to implement this on worldcricketwatch.com using Genesis Sample.
Which php file do I insert the code into or do I create a new one?
Any help would be much appreciated.
Please add the PHP code at the end of your child themes functions.php file.
Worked like a charm. Thanks so much Brad!
Glad you got it working David and hope it looks good in all browsers.