To add your own sidebar content without creating your own widget you can do the following:


add_shortcode('MY_SIDEBAR_CONTENT', 'my_sidebar_content'); 
add_filter('widget_text', 'my_custom_text_widget_shortcodes');
function my_custom_text_widget_shortcodes($text){
  ?>
ADD YOUR CONTENT HERE
  <?php
	//To allow other text from the widget text box to be shown we need to strip out our shortcode and return what's left
	$text = str_replace('[MY_SIDEBAR_CONTENT]', '', $text);
	return $text;
}

Then add a text widget to the sidebar using the normal wordpress widget page and enter [MY_SIDEBAR_CONTENT] in it.

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published.