WordPress “include TEMPLATEPATH” or?

I built something like this: Index Container Widgets Area and I created a widget for that – Categories Widget – Index Container .php with this in: <?php include (TEMPLATEPATH . ‘/includes/containers/container-grid-categories.php’); ?> <?php ///include (TEMPLATEPATH . ‘/includes/containers/container-list-categories.php’); ?> and for example in the /includes/containers/container-grid-categories.php is this: <?php //include (TEMPLATEPATH . ‘/includes/containers/container-grid-categories/grid-thumbs.php’); ?> <?php include (TEMPLATEPATH … Read more

How to add the widgets manually to the sidebar?

How can I add the widget manually in the code ? 2 Answers 2 Have a look at the the_widget() function. The first argument is required. It is the PHP class name of the widget. For example: <div class=”sidebar”> <?php the_widget(‘WP_Widget_Search’) ?> </div> You can also pass on extra arguments: <div class=”sidebar”> <?php the_widget(‘WP_Widget_Text’, ‘title=Hello&text=World’) … Read more

PHP 7 – Class Method Compatibility Issue

Can anyone help me to determine what function/statement in this file causes the fatal error after upgrading to php 7.0? On php 5.6 everything works fine. Error: “Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance)” on line 0 Code: class theme_navigation extends WP_Widget { public function __construct() { parent::__construct( ‘theme_navigation’, // Base ID ‘Child … Read more

How can I add an incremental class identifier to my sidebar widgets?

My sidebar widget code in functions.php looks like this… if ( function_exists(‘register_sidebar’) ) register_sidebar(array( ‘name’ => ‘Home Sidebar’, ‘id’ => ‘home-sidebar-widget’, ‘before_widget’ => ‘<div class=”menu side %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h4 class=”sidebarTitle”>’, ‘after_title’ => ‘</h4>’, )); Which creates this markup on the site… <div class=”menu side widget_text”> <h4>widget 1 title</h4> <div class=”textwidget”>Lorem ipsum … Read more

Style every second widget?

I need to apply a certain style to every second widget in my sidebar, and I’m reluctant to use :nth-child due to cross-browser compatibility issues. Is there a bit of PHP that will allow me to apply a class to every other widget? 3 Answers 3 Use the dynamic_sidebar_params filter. The following code adds classes … Read more