1. Home
  2. Car Demon Code Docs
  3. Display Filters
  4. cd_vdp_filter

cd_vdp_filter

This filter allows you to modify the VDP (Vehicle Display Page), also known as the Single Vehicle Page.

apply_filters( ‘cd_vdp_filter’, $content, $post_id );

add_filter( 'cd_vdp_filter', 'my_vdp', 10, 2 );
function my_vdp( $content, $post_id ) {

    //= Change or completely replace the VDP as desired.
    $content = '<div class="my_car">' . $content . '</div>';

    return $content;
}

The above example¬†will wrap the VDP in a <div> tag with a CSS class of “my_car”.

NOTE: You can access all vehicle data by setting a variable to the cd_get_car( $post_id ) function.

You can then use the print_r() function to display all the information you might want to use in your modified VDP.

$car = cd_get_car( $post_id );

echo '<pre>';
print_r( $car);
echo '</pre>';
Was this article helpful to you? Yes No

How can we help?