{"id":1287,"date":"2014-09-25T12:36:49","date_gmt":"2014-09-25T12:36:49","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=1287"},"modified":"2022-02-17T07:14:02","modified_gmt":"2022-02-17T07:14:02","slug":"add-your-own-sidebar-content","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/themes-wordpress\/child-themes\/add-your-own-sidebar-content","title":{"rendered":"Add your own sidebar content"},"content":{"rendered":"<p>\nTo add your own sidebar content without creating your own widget you can do the following:\n<\/p>\n<pre>\r\n<code>\r\nadd_shortcode(&#39;MY_SIDEBAR_CONTENT&#39;, &#39;my_sidebar_content&#39;); \r\nadd_filter(&#39;widget_text&#39;, &#39;my_custom_text_widget_shortcodes&#39;);\r\nfunction my_custom_text_widget_shortcodes($text){\r\n  ?&gt;\r\nADD YOUR CONTENT HERE\r\n  &lt;?php\r\n\t\/\/To allow other text from the widget text box to be shown we need to strip out our shortcode and return what&#39;s left\r\n\t$text = str_replace(&#39;[MY_SIDEBAR_CONTENT]&#39;, &#39;&#39;, $text);\r\n\treturn $text;\r\n}\r\n<\/code><\/pre>\n<p>\nThen add a text widget to the sidebar using the normal wordpress widget page&nbsp;and enter [MY_SIDEBAR_CONTENT] in it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To add your own sidebar content without creating your own widget you can do the following: add_shortcode(&#39;MY_SIDEBAR_CONTENT&#39;, &#39;my_sidebar_content&#39;); add_filter(&#39;widget_text&#39;, &#39;my_custom_text_widget_shortcodes&#39;); function my_custom_text_widget_shortcodes($text){ ?&gt; ADD YOUR CONTENT HERE &lt;?php \/\/To allow other text from the widget text box to be shown we need to strip out our shortcode and return what&#39;s left $text = str_replace(&#39;[MY_SIDEBAR_CONTENT]&#39;, &#39;&#39;, [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[126],"tags":[],"class_list":["post-1287","post","type-post","status-publish","format-standard","hentry","category-child-themes"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=1287"}],"version-history":[{"count":4,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1287\/revisions"}],"predecessor-version":[{"id":1291,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1287\/revisions\/1291"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=1287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=1287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=1287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}