1. Home
  2. Car Demon Code Docs
  3. Actions
  4. cd_header_sidebar_action

cd_header_sidebar_action

This action gets called at the top of the VDPs (Vehicle Display Pages) and can be used, for example, to add a custom sidebar area to the top of the vehicle.

do_action( ‘cd_header_sidebar_action’ );

add_action( 'cd_header_sidebar_action', 'my_header' );
function my_header() {

 $html = '<div id="vehicle_header_widget" class="vehicle_header_widget">';
     $html .= '<ul>';
         ob_start();
         if ( ! function_exists( 'dynamic_sidebar') || ! dynamic_sidebar( 'My Header Sidebar' ) ) :
         endif;
         $output = ob_get_contents();
         ob_end_clean();
         $html .= $output;
     $html .= '</ul>';
     $html .= '<br class="clear_car">';
 $html .= '</div>';
 if ( empty( $output ) ) {
     $html = '';
 }
 echo $html;
}

The above example will output the contents of the “My Header Sidebar” sidebar area.¬†This example assumes you have already registered the “My Header Sidebar” area. You can learn more about registering your own custom sidebar areas at WordPress.org

Was this article helpful to you? Yes No

How can we help?