File: /home/zwafgyp/dodolodge-net/wp-content/themes/hotel-wp/inc/widgets/shortcodes.php
<?php
if ( ! function_exists( "thim_get_cat_taxonomy" ) ) {
function thim_get_cat_taxonomy( $term = 'category', $cats = false, $vc = false ) {
if ( ! $cats ) {
$cats = array();
}
if ( is_admin() ) {
$terms = new WP_Term_Query(
array(
'taxonomy' => $term,
'orderby' => 'name',
'order' => 'DESC',
'child_of' => 0,
'parent' => 0,
'fields' => 'all',
'hide_empty' => false,
)
);
if ( is_wp_error( $terms ) ) {
} else {
if ( empty( $terms->terms ) ) {
} else {
$prefix = '';
foreach ( $terms->terms as $term ) {
if ( $term->parent > 0 ) {
$prefix = "--";
}
if ( $vc == true ) {
$cats[$prefix . $term->name] = $term->term_id;
} else {
$cats[$term->term_id] = $prefix . $term->name;
}
}
}
}
}
return $cats;
}
}
add_filter( 'thim_register_shortcode', 'thim_register_elements' );
if ( ! function_exists( 'thim_register_elements' ) ) {
/**
* @param $elements
*
* @return mixed
*/
function thim_register_elements() {
// elements want to add
$elements = array(
'general' => array(
'categories-link',
'counter-box',
'filter-gallery',
'google-map',
'heading',
'list-events',
'list-icon-box',
'our-gallery',
'posts',
'social_link',
'testimonials',
'video',
'weather',
'slider'
),
'WP_Hotel_Booking' => array(
'hb-rooms',
'hb-rooms-search',
'hb-room-slider',
)
);
return $elements;
}
}
add_filter( 'thim_shortcode_group_name', 'thim_shortcode_group_name' );
if ( ! function_exists( 'thim_shortcode_group_name' ) ) {
function thim_shortcode_group_name() {
return esc_html__( 'Thim Shortcodes', 'hotel-wp' );
}
}
// change folder shortcodes to widgets
if ( ! function_exists( 'thim_custom_folder_shortcodes' ) ) {
function thim_custom_folder_shortcodes() {
return 'widgets';
}
}
add_filter( 'thim_custom_folder_shortcodes', 'thim_custom_folder_shortcodes' );
// don't support folder groups
add_filter( 'thim_support_folder_groups', '__return_false' );