0

Being totally new to WordPress and (extremely) rusty with PHP, I'm having a difficult time figuring out how to add the Social Media Widget to my site's header. I'm using the Twenty Eleven theme, as I need the site to have no sidebars. Ideally, I'd like the social media icons to show up either above or below the site search box (image redacted for client's privacy):

Widget position

I've tried tutorials and have looked all over the web, but haven't been able to find anything that applies to my rather specific situation. Is this just too hard to do with this theme, and should I just go ahead and use icons instead of a widget? I'm pretty sure I can do this in functions.php and header.php, but how?

1 Answer 1

1

You can throw a widget anywhere into your template (if you do not want to use sidebar drag + drop) by calling the_widget.

In your case you would need to put this in the appropriate spot (maybe header.php or menu.php), you will have to figure out where you want it.

the_widget('Social_Widget ', $instance, $args);

Please view the ref page on what can be used for $instance and $args (for example this is where you put the widget title, parameters, etc): http://codex.wordpress.org/Function_Reference/the_widget

You should just use a register a new sidebar though , on account of this plugin have tons of options.

4
  • When I register a sidebar in functions.php, how do I get it to call the correct widget? After it's registered, how do I actually call the widget from header.php or searchForm.php?
    – AJ.
    Commented Jan 31, 2013 at 16:20
  • When you register a new sidebar it shows up in your admin under appearances, you typically just drag and drop a widget into it.
    – Wyck
    Commented Jan 31, 2013 at 16:29
  • Oooh, now I get it. OK, so I've got the sidebar showing up and I drag/dropped the widget onto it, but it's not showing up. Do I need to specifically invoke the sidebar somewhere? How?
    – AJ.
    Commented Jan 31, 2013 at 16:42
  • 1
    Never mind, figured out that I need to use dynamic_sidebar with the widget ID. Thanks!
    – AJ.
    Commented Jan 31, 2013 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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