How can I add a left sidebar in the realistic theme
Topics related to Realistic theme goes here.

User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How can I add a left sidebar in the realistic theme

linkPost by admin » Fri Aug 05, 2016 10:51 pm

shibaa987 wrote:Hi Asmi,

Once more I wanted to Thank you for your great effort to accomplish my wish to add a new left sidebar on the Realistic wordpress theme.

Here I found a minor bug after updating the search.php file as per the above guide. Because this is a public forum and someone might be following this thread will have the same issue that I had faced.

The primary issue was:
After updating with the above code everything on my Realistic theme was working just perfect except the search results. In the search results the right sidebar was coming after the main content area and not beside.

The issue was, Unlike other files (index.php, 404.php ...) the search.php does not have a div tag with primary id rather it has a section tag.

To Fix this issue Replace the following code in search.php file:
    <section id="primary" class="content-area mdl-cell mdl-cell--8-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone">
      <main id="main" class="site-main" role="main">
With the following
    <section id="primary" class="content-area mdl-grid mdl-cell mdl-cell--9-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone" style="padding:0;margin:0;">

      <?php if ( is_active_sidebar( 'sidebar-custom' ) ) { ?>
         <div id="sidebar-custom" class="widget-area mdl-cell mdl-cell--3-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone" role="complementary">
            <?php dynamic_sidebar( 'sidebar-custom' ); ?>
         </div>
      <?php } ?>

      <main id="main" class="site-main mdl-cell mdl-cell mdl-cell--9-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone" role="main">
Yeah, very true. It's better to replace section (line 10 & line 46) to div so all theme templates will be using the same tag. But this is optional.

The "section" tag was there because of the Underscores framework I used to build this theme. I have changed all section tags to div in all template files but forgot to change it in search.php, just saying :D
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
shibaa987

VIP Member Rank
Posts: 17
Joined: Mon Jul 18, 2016 11:36 am
Display Name: shibaa987

Re: How can I add a left sidebar in the realistic theme

linkPost by shibaa987 » Thu Aug 11, 2016 4:57 am

Many Thanks Asmi.
I have updated the max-width to 1200px and also changed the section tag in search.php to div.

I really appreciate your support :D and I will stay tuned to this forum because I wanna learn more.
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: How can I add a left sidebar in the realistic theme

linkPost by admin » Sat Aug 13, 2016 10:29 pm

Glad I helped you :D
If you have more question, feel free to ask!
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943

Who is online

Users browsing this forum: No registered users and 2 guests

It is currently Sat Apr 20, 2019 4:29 pm