How To Customize WordPress Sidebar To Match Your Theme Design?
October 2nd, 2016 | by Ravi Chahar || Leave a comment |
There are millions of WordPress websites from which, many websites have the sidebar. The development of the sidebar is dependent on the theme you use. To customize WordPress sidebar, you should understand its structure.
You can add new sidebar in WordPress theme and control it from the widgets area. But what would you do to modify it?
When you have a WordPress theme whose design isn’t so good and you want to edit WordPress sidebar according to you.
In such situation, you should know about HTML structure of the sidebar content. In this tutorial, I will provide you the best idea to design the items of the sidebar.
Customize WordPress Sidebar By Targeting the HTML Classes And IDs.
When you add the sidebar in your WordPress theme using the WordPress functions then you add a few classes for the heading, the sidebar content etc.
You can use those HTML classes to design the content of the sidebar of your website. First of all, you have to understand the code which is used to add sidebar in WordPress theme.
If you already have installed a theme then you can check the classes by inspecting the elements. Just right-click on the sidebar content and choose “inspect element”.
You would see all the HTML classes given for the heading, the list of the content etc.
NOTE:- You should know that when you add the sidebar feature in your WordPress theme then the content is shown with the help of unordered list, nested lists. The bullets of the list will be showing.
Start Editing WordPress Blog Sidebar. Add the CSS code in your style.css file.
Step 1:- Check the class of the whole sidebar content. It means when you show the recent post, popular posts in the sidebar then you can check its <div> tag and its class.
Depending on the developer’s choice, the class may vary. I am using the “widget-item” as the class.
You can add the margin, padding, and the background color for the whole content. Just target the HTML class.
padding-right: 0px 20px;
margin-bottom: 20px;
}
Step 2:- Remove the bullets of the list items.
list-style-type: none;
}
Here “widget-item” is the HTML class added while adding the sidebar.
Step 3:- If you want to use a different font size for the sidebar content then you have to target the unordered list.
font-size: 15px;
line-height: 1.5em;
}
Step 4:- If you have added the recent posts, related posts, popular posts in the sidebar then the links to the posts would be there to design.
You can change the color of the links and the hover effect can be given. You can easily customize WordPress sidebar after knowing the concept of CSS and HTML.
text-decoration: none;
color: blue;
}.widget-item ul li a:hover {
color: red;
}
Instead of blue and red color, you can use other colors. It’s just an example. You can design the content of the sidebar according to the theme you use.
Step 5:- Check the class or ID of the sidebar’s item heading. and design it. Choose the font size, font color, and many other attributes.
Try to maintain the color combination of the sidebar with the rest of the website.
Can You Now Customize WordPress Sidebar For A Better Design?
With this tutorial, I have given just an idea to edit WordPress sidebar. The main thing is to know the elements and its classes.
The default WordPress sidebar consists the nested lists and unordered lists. You just have to know the HTML classes and IDs to design using CSS language.
You can customize WordPress sidebar after checking the functions.php file and the theme support code which have enabled the sidebar in the theme.