A few notes for developers

You can view all of the articles for Developer’s here; https://cardemons.com/category/developers/

This page list serves as a basic foundation and introduction for developers. I’m not sure what information might come in handy, so I’ll briefly touch on a few items I think might be of initial interest. You can learn more details by following the link above or by clicking News on our menu.

If you think something needs to be added or expanded upon please let us know.

I highly suggest checking out the Developer’s page at WordPress.org;

From there you have access to all the current updates. You can even download the most current development copy from;

1. List of Shortcodes and their arguments
2. List of Taxonomies
3. List of Hooks and Filters
4. List of useful functions
5. Remove default .css or .js
6. Custom styles
7. Queries

1. List of Shortcodes and their arguments

  • contact_us – send_to, popup_id, popup_button
  • part_request – send_to, popup_id, popup_button
  • service_form – send_to, popup_id, popup_button
  • service_quote – send_to, popup_id, popup_button
  • trade – location
  • finance_form – location
  • qualify – location, popup_id, popup_button
  • highlight_staff – staff_id, contact_id, contact_button
  • vehicle_cloud – taxonomy, max_num, max_font, min_font
  • vehicle_search_box – button, message

send_to should equal an email address
popup_id should be a unique value that you create to identify this particular form, it also signals the shortcode to create a popup form, rather than embedding the form in the page.
popup_button is the custom text you’d like to display on the button to create the popup form.
location refers to the name given to that form under Car Demon Settings. If you have a location called “My first location” and entered “My Trade Department” into the name field for trade then you would enter “My Trade Department”
staff_id is the user_id of any staff member you would like to highlight, it can also be used to create a highlight for a sales person if their affiliate cookie has been dropped.

Shortcode In progress – show_inventory, this shortcode, once completed, will allow you to insert your inventory into any page, including the homepage. Currently there is not an estimated time frame for inclusion, but it is on the list.

2. Taxonomies

Car Demon uses several taxonomies to provide easy access to some of the most commonly searched items. Here’s the current list of taxonomies;

location, condition, year, make, model, body_style

All other information for each vehicle is stored in meta fields. In the case of vin decode information it is stored in a single field (vehicle_decode) as an array.

3. Hooks and Filters

do_action( ‘car_demon_before_main_content’ );
do_action( ‘car_demon_after_main_content’ );
do_action( ‘car_demon_vehicle_sidebar’ );
apply_filters(‘car_demon_mail_hook_complete’, $holder, ‘contact_us’, $to, $subject, $email_body, $headers, $_POST[’email’], $post_id, $_POST[‘send_to_name’]);
apply_filters(‘car_demon_mail_hook_subscribe’, $html, ‘contact_us’, ‘unk’, ‘0’);
$html = apply_filters(‘car_demon_display_car_list_filter’, car_demon_display_car_list($post_id), $post_id );
add_filter(‘car_demon_settings_hook’, ‘function_to_add_a_setting’,10,2);
add_filter(‘car_demon_settings_update_hook’, ‘function_to_save_setting’,10,2);
$html = apply_filters( ‘car_demon_photo_hook’, $html, $post_id, $details, $vehicle_condition, ‘desktop’ );

4. Useful functions

$car_contact = get_car_contact($post_id);
returns an array containing all of the contact information for the vehicle.

car_photos($post_id, $detail_output, $vehicle_condition);

$car = car_demon_get_car($post_id);
returns an array containing the most common information for the vehicle.

car_demon_display_similar_cars($body_style, $post_id); //displays similar vehicle

5. Remove default css and js

Car Demon Settings, in your Dashboard, lets you turn off several of the CSS files that it loads by default.

If you need more control then you can use wp_dequeue_script & wp_dequeue_style to unload the css and js that car demon loads.

Here are a few of the scripts and styles and how they’re currently loaded;

wp_enqueue_script(‘cd-jquery-lightbox-js’, $car_demon_pluginpath.’theme-files/js/jquery.lightbox_me.js’);
wp_enqueue_script(‘cd-jquery-autocomplete-js’, $car_demon_pluginpath.’theme-files/js/jquery.autocomplete.js’);
wp_enqueue_script(‘cd-compare-js’, $car_demon_pluginpath.’theme-files/js/car-demon-compare.js.php’);
wp_enqueue_style(‘cd-jquery-autocomplete-css’, $car_demon_pluginpath.’theme-files/css/jquery.autocomplete.css’);
wp_enqueue_style(‘car-demon-css’, $car_demon_pluginpath.’theme-files/css/car-demon.css.php’);
wp_enqueue_style(‘car-demon-style-css’, $car_demon_pluginpath.’theme-files/css/car-demon-style.css’);

Each of the forms also load their own css and js when their shortcodes are called. These are the files for the contact form.

wp_enqueue_script(‘car-demon-jquery-lightbox’, WP_CONTENT_URL . ‘/plugins/car-demon/theme-files/js/jquery.lightbox_me.js’, array(‘jquery’));
wp_enqueue_script(‘car-demon-contact-us-form-js’, WP_CONTENT_URL . ‘/plugins/car-demon/forms/js/car-demon-contact-us.js.php’);
wp_enqueue_script(‘car-demon-common-js’, WP_CONTENT_URL . ‘/plugins/car-demon/forms/js/car-demon-common.js.php’);
wp_enqueue_style(‘car-demon-contact-us-css’, WP_CONTENT_URL . ‘/plugins/car-demon/forms/css/car-demon-contact-us.css’);
wp_enqueue_script(‘car-demon-contact-us-popup-js’, WP_CONTENT_URL . ‘/plugins/car-demon/forms/js/car-demon-contact-us-popup.js.php’);
wp_enqueue_style(‘car-demon-contact-us-popup-css’, WP_CONTENT_URL . ‘/plugins/car-demon/forms/css/car-demon-contact-us-popup.css’);

6. Custom Styles

Car Demon works by switching out the theme’s default template files with files designed to work with the cars-for-sale post type. You can download the Car Demon Styles PlugIn and look at the different methods we used to create several different vehicle list and details pages. Use those as templates to create your own child theme.

You can also choose to turn off the css in the backend and style it yourself.

7. Queries

Archive and taxonomy pages call;
$car_demon_query = car_demon_query_archive();

Search Pages call;
$car_demon_query = car_demon_query_search();