Current File : /www/capitalgmcbuickregina_830/public/wp-content/themes/lbx-egypt/app/admin.php
<?php
/**
* Theme admin.
*/
namespace App;
use WP_Customize_Manager;
use function Roots\asset;
/**
* Register the `.brand` selector to the blogname.
*
* @param \WP_Customize_Manager $wp_customize
* @return void
*/
add_action('customize_register', function (WP_Customize_Manager $wp_customize) {
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial('blogname', [
'selector' => '.brand',
'render_callback' => function () {
bloginfo('name');
}
]);
});
/**
* Register the customizer assets.
*
* @return void
*/
add_action('customize_preview_init', function () {
wp_enqueue_script('sage/customizer.js', asset('scripts/customizer.js')->uri(), ['customize-preview'], null, true);
});
/**
* Inyecta los campos de geolocalización (Latitude / Longitude) en el panel
* "Dealer Settings → Contact", sección Address, que provee el plugin
* leadbox-plugin. No se modifica el plugin: este registra sus settings en
* `admin_init` y su callback `sanitize()` devuelve el input completo, así que
* basta con añadir dos campos más (con prioridad posterior) sobre la misma
* option `dealer-settings-contact-options` para que se guarden junto al resto
* de los datos de contacto. El theme los lee luego con get_dealer_contact()
* para el schema AutoDealer del <head>.
*
* @return void
*/
add_action('admin_init', function () {
// Misma guarda que usa el plugin: registra los campos tanto al mostrar el
// formulario de Contact como al guardarlo (options.php).
if (function_exists('leadbox_is_settings_page') && !leadbox_is_settings_page()) {
return;
}
$options = get_option('dealer-settings-contact-options');
$options = is_array($options) ? $options : [];
$render_field = function (string $key, string $placeholder) use ($options) {
printf(
'<input type="text" id="%1$s" name="dealer-settings-contact-options[%1$s]" value="%2$s" placeholder="%3$s" class="regular-text" inputmode="decimal" />',
esc_attr($key),
esc_attr($options[$key] ?? ''),
esc_attr($placeholder)
);
};
add_settings_field(
'latitude',
'Latitude',
function () use ($render_field) {
$render_field('latitude', 'e.g. 49.883304');
},
'dealer-settings-address',
'address'
);
add_settings_field(
'longitude',
'Longitude',
function () use ($render_field) {
$render_field('longitude', 'e.g. -97.195405');
},
'dealer-settings-address',
'address'
);
}, 11);
/**
* Normaliza Latitude / Longitude a 6 decimales (~11 cm) al guardar el panel de
* Contact, para no almacenar precisión innecesaria. Corre después del sanitize
* del plugin (que es passthrough), sin necesidad de modificarlo.
*
* @param mixed $value Valor entrante de la option.
* @return mixed
*/
add_filter('pre_update_option_dealer-settings-contact-options', function ($value) {
if (!is_array($value)) {
return $value;
}
foreach (['latitude', 'longitude'] as $key) {
if (isset($value[$key]) && is_numeric(trim((string) $value[$key]))) {
$value[$key] = \lbx_normalize_coordinate($value[$key]);
}
}
return $value;
});
/**
* Sección "Schema" en "Dealer Settings → Contact" (LBT-1510): controla dónde
* se emite el JSON-LD AutoDealer + LocalBusiness del <head>. Igual que los
* campos de geolocalización, los valores se guardan en la option
* `dealer-settings-contact-options` y el theme los lee con
* get_dealer_contact() en lbx_autodealer_schema_in_scope().
*
* @return void
*/
add_action('admin_init', function () {
if (function_exists('leadbox_is_settings_page') && !leadbox_is_settings_page()) {
return;
}
$options = get_option('dealer-settings-contact-options');
$options = is_array($options) ? $options : [];
add_settings_section(
'lbx-schema',
'Schema (AutoDealer JSON-LD)',
function () {
echo '<p>Structured data emitted in the site <code><head></code> for search engines and AI platforms (Shift Digital AI-Readiness).</p>';
},
'dealer-settings-address'
);
add_settings_field(
'schema_scope',
'Schema Scope',
function () use ($options) {
$scope = trim((string) ($options['schema_scope'] ?? ''));
$scope = $scope === '' ? 'all' : $scope;
$choices = [
'all' => 'All pages (SD "Suggested") — default',
'required' => 'Homepage, Service & About Us only (SD "Required" minimum)',
];
echo '<select id="schema_scope" name="dealer-settings-contact-options[schema_scope]">';
foreach ($choices as $value => $label) {
printf(
'<option value="%s"%s>%s</option>',
esc_attr($value),
selected($scope, $value, false),
esc_html($label)
);
}
echo '</select>';
},
'dealer-settings-address',
'lbx-schema'
);
add_settings_field(
'schema_required_pages',
'Required Page Slugs',
function () use ($options) {
printf(
'<input type="text" id="schema_required_pages" name="dealer-settings-contact-options[schema_required_pages]" value="%s" placeholder="%s" class="regular-text" />',
esc_attr($options['schema_required_pages'] ?? ''),
esc_attr('about-us, service')
);
echo '<p class="description">Comma-separated page slugs that emit the schema besides the homepage. Only used with the "Homepage, Service & About Us only" scope. Empty = <code>about-us, service</code>.</p>';
},
'dealer-settings-address',
'lbx-schema'
);
}, 12);
/**
* Sanitiza los campos de la sección Schema al guardar el panel de Contact:
* el scope se restringe a los valores conocidos y los slugs se normalizan
* con sanitize_title (acepta que el admin pegue títulos, p. ej. "About Us").
*
* @param mixed $value Valor entrante de la option.
* @return mixed
*/
add_filter('pre_update_option_dealer-settings-contact-options', function ($value) {
if (!is_array($value)) {
return $value;
}
if (isset($value['schema_scope'])) {
$value['schema_scope'] = in_array($value['schema_scope'], ['all', 'required'], true)
? $value['schema_scope']
: 'all';
}
if (isset($value['schema_required_pages'])) {
$value['schema_required_pages'] = implode(', ', array_filter(array_map(
'sanitize_title',
explode(',', (string) $value['schema_required_pages'])
)));
}
return $value;
});
Thank you for choosing Capital GMC Buick | Regina, your premier certified Buick and GMC dealership proudly serving drivers in Regina and the surrounding communities. Whether you’re searching for a brand-new Buick or GMC vehicle or a meticulously inspected pre-owned model, we have a diverse selection to match your needs and lifestyle.
Beyond our impressive inventory, we offer a seamless and stress-free financing experience through our well-connected finance centre, where our team of experts is dedicated to securing the best loan or lease options for you, quickly, transparently, and hassle-free.
But our commitment to you doesn’t stop at the sale. Our state-of-the-art service centre is staffed with skilled Buick and GMC technicians who use the latest equipment and genuine OEM parts to keep your vehicle running at its best. From routine maintenance to complex repairs, we’ve got you covered.
Experience top-tier customer service, quality vehicles, and expert care, all in one place. Visit Capital GMC Buick | Regina today or call us at 306-205-8072 with any questions. We’re here to help!
Have a question or need assistance? Fill out the form and we will reach out to you as soon as possible.
Schedule a Visit
Let us know when you are coming and how we can assist you. We can ensure someone will be on hand to help you out at the desired date and time.
Find a Career
Have a look at our list of available positions and apply online today to join our team!
Opportunities to Grow
The auto industry is constantly changing and we want to continue to grow. We offer growth, leadership & mentorship programs to allow our staff to grow with us.
Competitive Salary
We have a significant earning potential with incentive-based pay in most roles. We also offer an employee referral bonus with paid bonuses.
Health & Dental
We offer a comprehensive benefits package including extended health, dental, and vision care. We also include paramedical, life insurance, paid sick leave, short & long-term disability coverages.
Vacation
We value our employees and want everyone to take their vacation time. We offer a minimum of 2 weeks vacation each year.
Training & Development
We have many opportunities for paid education and training in-house as well as training from the Manufacturer.
$10,000 Cash Giveaway – Terms & Conditions
All October long, stop by Capital GMC Buick Cadillac, to enter for your chance to win $10,000 cash. No purchase is required, but entries must be made in-store.
The contest is open to residents of Saskatchewan who are 18+. Dealership employees and their households are not eligible. Entries will be accepted from October 1 to October 31, 2025. A random draw will take place on November 1, 2025.
The prize is one $10,000 award, paid by cheque, and must be accepted as awarded. Winner will be contacted by phone or email and must respond within 7 days or another entry may be drawn. Odds of winning depend on the number of entries received.By entering, you agree that Capital Automotive Group may use your name and photo for winner announcements. The contest is governed by the laws of Saskatchewan.