Custom Sidebars
[Plugin: Custom sidebars] Before and After Widget? (5 posts)

  1. greencode
    Posted 5 years ago #

    I'm trying to add the following to the Before Widget field:

    <div class="sidebar-element2">

    But upon save it comes back as:

    <div class=\"sidebar-element2\">

    Any idea how to add that without the backslashes appearing?


  2. marquex
    Plugin Author

    Posted 5 years ago #

    You are right! Nice one, I will fix it for the next version of the plugin.

    Meanwhile you can substitute the code from line 555 to 561 on customsidebars.php - Plugins > Edit > Custom Sidebars

    $id = trim($_POST['cs_id']);
    $name = trim($_POST['sidebar_name']);
    $description = trim($_POST['sidebar_description']);
    $before_widget = trim($_POST['cs_before_widget']);
    $after_widget = trim($_POST['cs_after_widget']);
    $before_title = trim($_POST['cs_before_title']);
    $after_title = trim($_POST['cs_after_title']);

    replace it with:

    $id = stripslashes(trim($_POST['cs_id']));
    $name = stripslashes(trim($_POST['sidebar_name']));
    $description = stripslashes(trim($_POST['sidebar_description']));
    $before_widget = stripslashes(trim($_POST['cs_before_widget']));
    $after_widget = stripslashes(trim($_POST['cs_after_widget']));
    $before_title = stripslashes(trim($_POST['cs_before_title']));
    $after_title = stripslashes(trim($_POST['cs_after_title']));
  3. millbank
    Posted 4 years ago #

    First of all. Amazing plugin! It's so versatile and in my mind a feature like this should be part of the base install of WordPress. Thank you.

    I had to add the fix above, but the code didn't start on line 555, but rather on 691. Once the code was replaced, it fixed the problem with the backslashes for me.

  4. Bucketsaway
    Posted 4 years ago #

    I'm having a similar problem using plugin version 0.8.1 and wordpress 3.2.1. I modified customsidebars.php as you suggested (the code apparently still hasn't been updated), but in addition, whenever I put ANYTHING in the "Before title", "After title", "Before widget", or "After widget" areas, it breaks the sidebar completely. Without anything there, it works fine. But I need to style different sidebars with different div classes...

    Unfortunately, I'm using a graphpaperpress theme, which is a premium theme, so I know your assistance can only be limited. But if you have any thoughts on what might be causing the problem, I'm be delighted to hear them!


  5. wpcsphil
    Posted 4 years ago #

    Love the plugin, but have to hunt this post down everytime to find where to escape the quotes. Maybe you can just implement this sometime soon instead of waiting for the whole next version? Would be helpful :)

    Thanks for the great plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Sidebars
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic