Sidebar

darko1x

Member
I really need help, i'm looking for a way to add a sidebar and widgets on davinci theme.
is there any plugin or a combination to do so ? i have some advert offers and i need widgets...
 

cgkcgk31

New Member
The themes are not (widget aware) this means you will have to add a few lines of code to your functions.php file for a widget plugin to work
. you can do a search on non widget aware themes (which alidropship themes are) and it will tell you how to do it, but ive actaully tried this before and i could not get it to work. these are the instructions: Here is source link
Keep in mind (because ive aleady tried this many times and cant figure it out) that if you use this code in your functions .php file and hit update, you will prpbably get a server 500 error and you probably cant delete the code from the wp-dashboard. you will have to delete it from your cpanel file manager. If you figure it out please let me know..
The following should be added to your Theme's functions.php file:

<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function arphabet_widgets_init() {

register_sidebar( array(
'name' => 'Home right sidebar',
'id' => 'home_right_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );

}
add_action( 'widgets_init', 'arphabet_widgets_init' );
?>
You can display your new widget area by:

  1. Adding the code directly to a theme file like the sidebar.php file; or
  2. Using a custom function with hook in your functions.php file.
Here's some example code that is a common way to add your new widget area to a parent or child theme:

<?php if ( is_active_sidebar( 'home_right_1' ) ) : ?>
<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'home_right_1' ); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
 
Top