public function position() { global $listify_job_manager; $position = listify_theme_mod('listing-archive-facetwp-position'); // Force if the map is already on the side if ('side' == $listify_job_manager->map->template->position() && $listify_job_manager->map->template->display() || listify_is_widgetized_page()) { $position = 'top'; } return $position; }
/** * Constructor */ public function __construct() { $this->widget_description = __('Display a map and results of listings', 'listify'); $this->widget_id = 'listify_widget_map_listings'; $this->widget_name = __('Listify - Page: Map', 'listify'); $this->settings = array('title' => array('type' => 'text', 'std' => 'Recent Listings', 'label' => __('Title:', 'listify')), 'description' => array('type' => 'text', 'std' => 'Discover some of our best listings', 'label' => __('Description:', 'listify')), 'results' => array('type' => 'checkbox', 'std' => 1, 'label' => __('Display results', 'listify')), 'limit' => array('type' => 'number', 'std' => 3, 'min' => 1, 'max' => 30, 'step' => 1, 'label' => __('Number of listings per page:', 'listify'))); parent::__construct(); if (is_active_widget(false, false, $this->widget_id, true) || listify_is_widgetized_page()) { add_filter('listify_page_needs_map', '__return_true'); } }
public function add_to_cart_url($url, $product) { if (!(is_page_template('page-templates/template-plans-pricing.php') || listify_is_widgetized_page())) { return $url; } if (!in_array($product->product_type, array('subscription', 'job_package', 'job_package_subscription'))) { return $url; } if ('' == ($submit = job_manager_get_permalink('submit_job_form'))) { return $url; } $url = add_query_arg('selected_package', $product->id, $submit); return esc_url($url); }
/** * Set the body class based on how the map is being output */ public function body_class($classes) { global $post; if (listify_is_job_manager_archive() && 'side' == $this->position() && $this->display() && !listify_is_widgetized_page()) { $classes[] = 'fixed-map'; } return $classes; }
public function get_grid_columns($style = false) { global $listify_job_manager, $wp_query; if ('list' == $style) { return apply_filters('listify_list_columns', 'col-xs-12'); } if ((listify_job_listing_archive_has_sidebar() || 'side' == $listify_job_manager->map->template->position()) && !(listify_is_widgetized_page() || is_page_template('page-templates/template-full-width-blank.php')) || is_singular('job_listing')) { $cols = apply_filters('listify_grid_columns_sidebar', 'col-xs-12 col-sm-6'); } else { $cols = apply_filters('listify_grid_columns_no_sidebar', 'col-xs-12 col-sm-6 col-md-4'); } return $cols; }
public function job_manager_output_jobs_defaults($default) { $type = get_queried_object(); if (is_tax('job_listing_type')) { $default['job_types'] = $type->slug; $default['selected_job_types'] = $type->slug; $default['show_categories'] = true; } elseif (is_tax('job_listing_category')) { $default['show_categories'] = true; $default['categories'] = $type->slug; $default['selected_category'] = $type->slug; } elseif (is_search()) { $default['keywords'] = get_search_query(); $default['show_filters'] = false; } if (is_home() || listify_is_widgetized_page()) { $default['show_category_multiselect'] = false; } if (isset($_GET['search_categories'])) { $categories = array_filter(array_map('esc_attr', $_GET['search_categories']), 'listify_array_filter_deep'); if (!empty($categories)) { $default['selected_category'] = $categories[0]; } $default['show_categories'] = true; $default['categories'] = false; } return $default; }
/** * Adds custom classes to the array of body classes. */ function listify_body_classes($classes) { global $wp_query, $post; if (is_page_template('page-templates/template-archive-job_listing.php')) { $classes[] = 'template-archive-job_listing'; } if (listify_is_widgetized_page()) { $classes[] = 'template-home'; } if (is_page_template('page-templates/template-full-width-blank.php') || isset($post) && has_shortcode(get_post()->post_content, 'jobs')) { $classes[] = 'unboxed'; } if (is_singular() && get_post()->enable_tertiary_navigation) { $classes[] = 'tertiary-enabled'; } if (listify_theme_mod('fixed-header')) { $classes[] = 'fixed-header'; } if (listify_theme_mod('custom-submission')) { $classes[] = 'directory-fields'; } $classes[] = 'color-scheme-' . sanitize_title(listify_theme_mod('color-scheme')); $classes[] = 'footer-' . listify_theme_mod('footer-display'); $theme = wp_get_theme('listify'); if ($theme->get('Name')) { $classes[] = sanitize_title($theme->get('Name')); $classes[] = sanitize_title($theme->get('Name') . '-' . str_replace('.', '', $theme->get('Version'))); } return $classes; }