{"id":12339782,"date":"2020-01-18T16:23:32","date_gmt":"2020-01-18T16:23:32","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/cant-add-new-or-remove-old-widgets\/"},"modified":"2020-01-18T20:13:33","modified_gmt":"2020-01-18T20:13:33","slug":"cant-add-new-or-remove-old-widgets","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/cant-add-new-or-remove-old-widgets\/","title":{"rendered":"Can&#8217;t add new or remove old widgets"},"content":{"rendered":"<p>I have created my own wordpress theme, and have used it for several websites.  It includes several customised widgets.. some on the home page, and some just in the sidebars of specific pages.  All has worked fine&#8230; until this latest new website.<\/p>\n<p>I am using the same theme, and the same function.php and a similar front.php page.  But when I deleted 3 widgets in my function.php page (used on the previous website, not being used here), and tried to add a new widget specific to this website &#8211; nothing changes on the list of widgets in the admin dashboard (found under the appearance section).. I still see the old widgets listed, and I don&#8217;t see the new one.<\/p>\n<p>I am working on localhost right now, so I can&#8217;t give you a link, but here is all the relevant code (I think) that I have in function.php and front.php to display new widgets.<\/p>\n<p><strong>FUNCTION.PHP:<\/strong><\/p>\n<pre><code>function create_widget( $name, $id, $description, $beforewidget, $beforetitle, $aftertitle ) {\n\n\tregister_sidebar(array(\n\t\t&#039;name&#039; =&gt; __( $name ),\t \n\t\t&#039;id&#039; =&gt; $id, \n\t\t&#039;description&#039; =&gt; __( $description ),\n\t\t&#039;before_widget&#039; =&gt; $beforewidget,\n\t\t&#039;after_widget&#039; =&gt; &#039;&lt;\/div&gt;&#039;,\n\t\t&#039;before_title&#039; =&gt; $beforetitle,\n\t\t&#039;after_title&#039; =&gt; $aftertitle,\n\t));\n\n}\n\ncreate_widget( &#039;Front Page Blog&#039;, &#039;front-blog&#039;, &#039;Displays just under hero image of the homepage&#039;, &#039;&lt;div class=&quot;widget&quot;&gt;&#039;, &#039;&lt;h3&gt;&#039;, &#039;&lt;\/h3&gt;&#039; );\n\n<\/code><\/pre>\n<ul>Note:<\/ul>\n<p> <em>I didn&#8217;t include the <strong>create_widget<\/strong> lines that I removed for the old widgets.. but even after I removed their create statements from the function.php page, they still show up in the list of widgets.<\/em><\/p>\n<p><strong>FRONT.PHP:<\/strong><\/p>\n<pre><code>          &lt;div class=&quot;thumbnail-kenburn thumbnail-kenburnl&quot;&gt;\n\t\t\t&lt;h1&gt;Latest from the Blog&lt;\/h1&gt;\n\n\t\t\t&lt;?php if ( dynamic_sidebar ( &#039;front-blog&#039; ) ); ?&gt;\n\n          &lt;\/div&gt;\n<\/code><\/pre>\n<p>Obviously nothing will show up on the front.php (home) page, as I can&#8217;t customise the widget yet.. because it isn&#8217;t in the list on the admin widget area!.<\/p>\n<p>Do I need to change some other area of wordpress to add a new widget?<\/p>\n<p>I am sure it is something silly I have done or not done, but I can&#8217;t seem to figure it out after spending most of the day researching and playing with various suggested changes.  I just don&#8217;t understand how I was able to add widgets in the past with this same theme and same files, and can&#8217;t do it now.<\/p>\n<p>Any guidance would be greatly appreciated.<\/p>\n<p>Cheers,<br \/>\nSunnyOz<\/p>\n","protected":false},"template":"","class_list":["post-12339782","topic","type-topic","status-publish","hentry","topic-tag-function-php","topic-tag-widget"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12339782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12339782\/revisions"}],"predecessor-version":[{"id":12340236,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12339782\/revisions\/12340236"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12339782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}