Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]

osclass-customization-add-widget-manually-sidebar
In this post, we shall see how to customize OSCLASS to add widget areas in the sidebar manually. OSClass has few widget supported themes. Modern theme is one that supports a header and footer widget areas. But by default there is only one sidebar widget that shows locations. You may want to have more widget areas to display other content such as advertisements, or other content.

To add widget sections in the sidebar manually, follow the instructions below. In this example, I am going to use the OSCLASS Modern Theme.
Open the main.php file that is in the theme’s folder. The main.php is the file for the home page.

If your themes is Modern, go to public_html/oc-content/themes/modern
Look for DIV with ID=”sidebar” at the end of the file which looks like this:

<div id="sidebar">
//this defines the entire right hand side sidebar

Just below the <div id="sidebar">, there will be another DIV by the ID <div class="navigation">.

<div class="navigation">
//this is for the section within the sidebar 

By default the sidebar section shows locations. And the code looks like as given below:

<div id="sidebar">
    <div class="navigation">
        <?php if(osc_count_list_regions() > 0 ) { ?>
            <div class="box location">
                <h3><strong><?php _e("Location", 'modern'); ?></strong></h3>
                <ul>
                <?php while(osc_has_list_regions() ) { ?>
                <li><a href="&lt;?php echo osc_list_region_url(); ?>">
                <?php echo osc_list_region_name(); ?></a>
                <em>(<?php echo osc_list_region_items(); ?>)</em></li>
                <?php } ?>
                </ul>
            </div>  //DIV ENDS FOR "Box Location"
        <?php } ?>
    </div> //DIV ENDS FOR Navigation


To add a new section in the right sidebar, end the DIV tag with class=navigation above and start a new DIV navigation.

<div class="navigation">
    <div class="box location">
        //Your code goes here
        //Insert Google Adsense Code etc.
    </div>
</div>


Similarly, to add another section, add another DIV block

<div class="navigation">
    <div class="box location">
        //Your code goes here
    </div>
</div>



This way, you can add any number of additional widget areas manually in the sidebar of OSCLASS Theme. If you are using another theme, check for the class / ID names of the DIVs and edit accordingly.




No comments:

Post a Comment

Bottom Ad [Post Page]