How to remove custom widget area? - by tommyseven

This topic has 8 replies, 2 voices, and was last updated 6 years, 2 months ago ago by Rose Tyler

  • Avatar: tommyseven
    tommyseven
    Participant
    February 14, 2018 at 15:55

    Hi, good day.

    I’m not sure if this question was already asked but I’m gonna ask anyway.

    How can I remove a custom widget area once its created? I can’t seem to find a delete button once the Additional Custom Sidebar is created.

    Regards,

    7 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 14, 2018 at 16:31

    Hello,

    Please find legenda/framework/js/admin.js file
    http://prntscr.com/ieo2e0
    and replace with

    var delSidebar = '<div class="delete-sidebar">delete</div>';
      
      jQuery('.sidebar-etheme_custom_sidebar').find('.handlediv').before(delSidebar);
      
      jQuery('.delete-sidebar').click(function(){
        
        var confirmIt = confirm('Are you sure?');
        
        if(!confirmIt) return;
        
        var widgetBlock = jQuery(this).closest('.sidebar-etheme_custom_sidebar');
      
        var data =  {
          'action':'etheme_delete_sidebar',
          'etheme_sidebar_name': jQuery(this).parent().find('h2').text()
        };
        
        widgetBlock.hide();
        
        jQuery.ajax({
          url: ajaxurl,
          data: data,
          success: function(response){
            console.log(response);
            widgetBlock.remove();
          },
          error: function(data) {
            alert('Error while deleting sidebar');
            widgetBlock.show();
          }
        });
      });

    http://prntscr.com/ieo36j
    Also, this will be fixed in next theme update.

    Regards

    Avatar: tommyseven
    tommyseven
    Participant
    February 14, 2018 at 19:05

    Hi thanks for the reply.

    I also noticed that the generated ID is the same with the name of the custom widget area. Example I created a custom widget area of “Fußzeile Rechnung” the generated ID will also be id=”Fußzeile Rechnung” which I think is not good, it is suppose to be id=”fusszeile-rechnung”.

    See screenshot – https://prnt.sc/ieqscr

    Regards,

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 15, 2018 at 08:53

    Hello,

    Thanks for the notice.
    Please go to legenda/framework/theme-functions.php
    find etheme_register_stored_sidebar function
    http://prntscr.com/iez4t5 and replace the id
    with 'id' => str_replace( ' ', '-', $name ),
    http://prntscr.com/iez57x

    Regards

    Avatar: tommyseven
    tommyseven
    Participant
    February 15, 2018 at 09:04

    Hi,

    The solution that you give, will that be included in the next update?

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 15, 2018 at 09:14

    Hello,

    Yes, we will include this solution also.

    Regards

    Avatar: tommyseven
    tommyseven
    Participant
    February 15, 2018 at 16:18

    Awesome! Thanks.

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 15, 2018 at 16:21

    You’re welcome!
    Have a nice day.

    Regards

  • Viewing 8 results - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.Log in/Sign up

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.