public function register_post_types() { if (!listify_theme_mod('categories-only')) { return; } register_taxonomy('job_listing_type', array()); }
public function __construct() { $this->labels = array('singular' => listify_theme_mod('label-singular'), 'plural' => listify_theme_mod('label-plural')); $this->strings = $this->get_strings(); add_filter('gettext', array($this, 'gettext'), 0, 3); add_filter('gettext_with_context', array($this, 'gettext_with_context'), 0, 4); add_filter('ngettext', array($this, 'ngettext'), 0, 5); }
public function get_facets($flat = false) { $facets = listify_theme_mod('listing-archive-facetwp-defaults'); if ($flat) { return $facets; } $facets = array_map('trim', explode(',', $facets)); return $facets; }
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->position() && $listify_job_manager->map->display() || is_page_template('page-templates/template-home.php')) { $position = 'top'; } return $position; }
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; }
public function geolocation_endpoint($url) { $key = listify_theme_mod('map-behavior-api-key'); $args = array('language' => get_locale() ? substr(get_locale(), 0, 2) : ''); if ($key && '' != $key) { $args['key'] = $key; } $url = add_query_arg($args, $url); return esc_url($url); }
public function filters() { $this->labels = array('singular' => listify_theme_mod('label-singular'), 'plural' => listify_theme_mod('label-plural')); /* print_r( $this->labels ); */ $this->strings = $this->get_strings(); $this->domains = apply_filters('listify_gettext_domains', array('listify', 'wp-job-manager', 'wp-job-manager-tags', 'wp-job-manager-alerts', 'wp-job-manager-locations', 'wp-job-manager-wc-paid-listings', 'wp-job-manager-simple-paid-listings')); $this->translations = get_translations_for_domain('listify'); add_filter('gettext', array($this, 'gettext'), 0, 3); add_filter('gettext_with_context', array($this, 'gettext_with_context'), 0, 4); add_filter('ngettext', array($this, 'ngettext'), 0, 5); }
function listify_get_top_level_taxonomy() { $categories_enabled = get_option('job_manager_enable_categories'); $categories_only = listify_theme_mod('categories-only'); if ($categories_enabled && $categories_only) { $tax = 'job_listing_category'; } else { $tax = 'job_listing_type'; } return $tax; }
public function enqueue_scripts($force = false) { if (!$this->page_needs_map($force)) { return; } wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?v=3&libraries=geometry,places'); wp_enqueue_script('listify-job-manager-map', Listify_Integration::get_url() . 'js/wp-job-manager-map.min.js', array('jquery', 'jquery-ui-slider', 'google-maps', 'underscore'), 20141204); $settings = array('facetwp' => listify_has_integration('facetwp'), 'canvas' => 'job_listings-map-canvas', 'useClusters' => listify_theme_mod('map-behavior-clusters'), 'gridSize' => listify_theme_mod('map-behavior-grid-size'), 'autoFit' => listify_theme_mod('map-behavior-autofit'), 'mapOptions' => array('zoom' => listify_theme_mod('map-behavior-zoom'), 'maxZoom' => listify_theme_mod('map-behavior-max-zoom')), 'searchRadius' => array('min' => listify_theme_mod('map-behavior-search-min'), 'max' => listify_theme_mod('map-behavior-search-max'))); if ('' != ($center = listify_theme_mod('map-behavior-center'))) { $settings['mapOptions']['center'] = $center; } wp_localize_script('listify-job-manager-map', 'listifyMapSettings', apply_filters('listify_map_settings', $settings)); }
public function markers() { $terms = get_terms(listify_get_top_level_taxonomy(), array('hide_empty' => 0)); if (is_wp_error($terms)) { return; } foreach ($terms as $term) { $color = listify_theme_mod('marker-color-' . $term->term_id); $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ':after'), 'declarations' => array('border-top-color' => $color))); $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ' i:after'), 'declarations' => array('background-color' => $color))); $this->css->add(array('selectors' => array('.map-marker.type-' . $term->term_id . ' i:before'), 'declarations' => array('color' => $color))); } }
/** * Constructor */ public function __construct() { if (listify_theme_mod('categories-only')) { $this->taxonomy = 'job_listing_category'; } else { $this->taxonomy = 'job_listing_type'; } $this->get_terms(); $this->widget_description = __('Display a tabbed layout of listing types', 'listify'); $this->widget_id = 'listify_widget_tabbed_listings'; $this->widget_name = __('Listify - Page: Tabbed Listings', 'listify'); $this->settings = array('title' => array('type' => 'text', 'std' => 'What\'s New', 'label' => __('Title:', 'listify')), 'limit' => array('type' => 'number', 'std' => 3, 'min' => 3, 'max' => 30, 'step' => 3, 'label' => __('Number per tab:', 'listify')), 'featured' => array('type' => 'checkbox', 'std' => 0, 'label' => __('Use Featured listings', 'listify')), 'terms' => array('label' => __('Types to Feature:', 'listify'), 'type' => 'multicheck', 'std' => '', 'options' => $this->get_terms_simple())); parent::__construct(); }
/** * Styles the header image displayed on the Appearance > Header admin panel. * * @see listify_custom_header_setup(). */ function listify_admin_header_style() { /* Supplimentary CSS */ wp_enqueue_style('listify-fonts', listify_fonts_url()); $header_image = get_custom_header(); ?> <style type="text/css"> .appearance_page_custom-header #headimg { border: none; background-color: <?php echo listify_theme_mod('colors-header-background'); ?> ; padding: 10px; width: auto; } .appearance_page_custom-header #headimg img { margin-right: 10px; } #headimg h1, #desc { } #headimg h1 { margin: 0 0 0 40px; font-family: 'Montserrat', sans-serif; font-size: 26px; font-weight: normal; line-height: <?php echo get_custom_header()->height; ?> px } #headimg h1 a { text-decoration: none; } #desc { display: none; } #headimg img { float: left; } </style> <?php }
public function setup_actions() { add_action('after_setup_theme', array($this, 'after_setup_theme')); add_action('widgets_init', array($this, 'widgets_init')); add_action('pre_get_posts', array($this, 'hide_packages_from_shop')); add_filter('user_contactmethods', array($this, 'user_contactmethods'), 10, 2); if ('user' == listify_theme_mod('social-association')) { add_action('woocommerce_edit_account_form', array($this, 'woocommerce_edit_account_form')); add_action('woocommerce_save_account_details', array($this, 'woocommerce_save_account_details')); } add_filter('woocommerce_localisation_address_formats', array($this, 'address_formats')); add_filter('woocommerce_localisation_address_formats', array($this, 'address_formats_shim'), 99); add_filter('woocommerce_formatted_address_replacements', array($this, 'address_replacements'), 10, 2); add_filter('woocommerce_formatted_address_replacements', array($this, 'address_schema'), 9, 2); }
public function set_controls($wp_customize) { $this->controls = apply_filters('listify_pre_controls_' . $this->section, $this->controls, $this->section, $wp_customize); foreach ($this->controls as $key => $control) { $defaults = array('priority' => $this->priority->next(), 'type' => 'text', 'section' => $this->section); $control = wp_parse_args($control, $defaults); $wp_customize->add_setting($key, array('default' => listify_theme_mod($key))); if (class_exists($control['type'])) { $type = $control['type']; unset($control['type']); $wp_customize->add_control(new $type($wp_customize, $key, $control)); } else { $wp_customize->add_control($key, $control); } } }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { if ($this->get_cached_widget($args)) { return; } extract($args); global $post; $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $icon = isset($instance['icon']) ? $instance['icon'] : null; if ($icon) { $before_title = sprintf($before_title, 'ion-' . $icon); } $methods = wp_get_user_contact_methods(); $output = array(); foreach ($methods as $method => $label) { if ('user' == listify_theme_mod('social-association')) { $value = get_the_author_meta($method, $post->post_author); } else { $value = get_post_meta($post->ID, '_company_' . $method, true); } if ('' == $value) { continue; } if ($value && !strstr($value, 'http:') && !strstr($value, 'https:')) { $value = 'http://' . $value; } $output[] = sprintf('<a href="%s" target="_blank" class="ion-social-%s">%s</a>', $value, $method, $label); } if (empty($methods) || empty($output)) { return; } ob_start(); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } do_action('listify_widget_job_listing_social_before'); echo '<ul class="social-profiles"><li>' . implode('</li><li>', $output) . '</li></ul>'; do_action('listify_widget_job_listing_social_after'); echo $after_widget; $content = ob_get_clean(); echo apply_filters($this->widget_id, $content); $this->cache_widget($args, $content); }
public function init() { if (1 != listify_theme_mod('custom-submission')) { return; } global $listify_job_manager; $listify_job_manager->business_hours = new Listify_WP_Job_Manager_Business_Hours(); add_filter('submit_job_form_fields', array($this, 'remove_company')); add_filter('submit_job_form_fields', array($this, 'job_category')); add_filter('submit_job_form_fields', array($this, 'job_tag')); add_filter('submit_job_form_fields', array($this, 'contact')); add_filter('submit_job_form_fields', array($this, 'featured_image')); add_filter('submit_job_form_fields', array($this, 'gallery_images')); add_filter('submit_job_form_fields', array($this, 'phone')); add_filter('job_manager_job_listing_data_fields', array($this, 'admin_phone')); add_filter('job_manager_job_listing_data_fields', array($this, 'admin_remove_company')); add_filter('submit_job_form_fields_get_job_data', array($this, 'get_job_data'), 10, 2); add_action('job_manager_update_job_data', array($this, 'save_featured_image'), 10, 2); add_action('job_manager_update_job_data', array($this, 'save_gallery_images'), 10, 2); add_filter('the_company_logo', array($this, 'the_company_logo'), 10, 2); add_filter('submit_job_form_save_job_data', array($this, 'enable_comments'), 10, 5); }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { if ($this->get_cached_widget($args)) { return; } global $job_manager, $job_preview, $post; extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $icon = isset($instance['icon']) ? $instance['icon'] : null; $gallery = Listify_WP_Job_Manager_Gallery::get(get_post()->ID); if (empty($gallery)) { return; } $limit = isset($instance['limit']) ? $instance['limit'] : 8; $gallery = array_splice($gallery, 0, $limit); if ($icon) { $before_title = sprintf($before_title, 'ion-' . $icon); } ob_start(); echo $before_widget; if ($title) { echo $before_title . sprintf('<a href="%s" class="image-gallery-link">%s</a>', Listify_WP_Job_Manager_Gallery::url(), $title) . $after_title; } do_action('listify_widget_job_listing_gallery_slider_before'); ?> <div class="listing-gallery"> <?php foreach ($gallery as $item) { ?> <?php $image = wp_get_attachment_image_src($item, 'fullsize'); ?> <?php $link = $job_preview || !listify_theme_mod('gallery-comments') ? $image[0] : get_attachment_link($item); ?> <div class="listing-gallery__item"><a href="<?php echo esc_url($link); ?> " class="listing-gallery__item-trigger"> <?php echo wp_get_attachment_image($item, 'large'); ?> </a></div> <?php } ?> </div> <div class="listing-gallery-nav"> <?php foreach ($gallery as $item) { ?> <div class="listing-gallery-nav__item"> <div class="item__wrapper"><?php echo wp_get_attachment_image($item, 'thumbnail'); ?> </div> </div> <?php } ?> </div> <?php do_action('listify_widget_job_listing_gallery_slider_after'); echo $after_widget; $content = ob_get_clean(); echo apply_filters($this->widget_id, $content); $this->cache_widget($args, $content); }
public function get_facets($facets = false) { $facets = $facets ? $facets : listify_theme_mod('listing-archive-facetwp-defaults'); $_facets = array(); if (!is_array($facets)) { $facets = array_map('trim', explode(',', $facets)); } foreach ($facets as $key => $facet_name) { $facet = FWP()->helper->get_facet_by_name($facet_name); if (!$facet) { continue; } $_facets[] = $facet; } return $_facets; }
?> <?php foreach ($attachments->posts as $id) { ?> <?php $thumb = wp_get_attachment_image_src($id, 'thumbnail'); ?> <?php $full = wp_get_attachment_image_src($id, 'fullsize'); ?> <li class="gallery-preview-image" style="background-image:url(<?php echo esc_url($thumb[0]); ?> ); ?>"> <?php if (!listify_theme_mod('gallery-comments')) { ?> <a href="<?php echo esc_url($full[0]); ?> " class="listing-gallery__item-trigger"></a> <?php } elseif (!$job_preview) { ?> <a href="<?php echo get_attachment_link($id); ?> "></a> <?php } ?>
public function enqueue_scripts($force = false) { $deps = array('jquery', 'jquery-ui-slider', 'google-maps', 'wp-backbone', 'wp-job-manager-ajax-filters'); if (class_exists('WP_Job_Manager_Extended_Location')) { $deps[] = 'wpjm-extended-location'; } $deps[] = 'listify'; $bias = strtolower(listify_theme_mod('region-bias')); $base = '//maps.googleapis.com/maps/api/js'; $args = array('v' => 3, 'libraries' => 'geometry,places', 'key' => listify_theme_mod('map-behavior-api-key'), 'language' => get_locale() ? substr(get_locale(), 0, 2) : ''); if ('' != $bias) { $args['region'] = $bias; } wp_enqueue_script('google-maps', esc_url_raw(add_query_arg($args, $base))); wp_enqueue_script('listify-app-map', Listify_Integration::get_url() . 'js/map/app.min.js', $deps, '20150213', true); $settings = array('displayMap' => (bool) $this->display(), 'facetwp' => listify_has_integration('facetwp'), 'useClusters' => (bool) listify_theme_mod('map-behavior-clusters'), 'autoFit' => (bool) listify_theme_mod('map-behavior-autofit'), 'trigger' => listify_theme_mod('map-behavior-trigger'), 'mapOptions' => array('zoom' => listify_theme_mod('map-behavior-zoom'), 'maxZoom' => listify_theme_mod('map-behavior-max-zoom'), 'maxZoomOut' => listify_theme_mod('map-behavior-max-zoom-out'), 'gridSize' => listify_theme_mod('map-behavior-grid-size'), 'scrollwheel' => listify_theme_mod('map-behavior-scrollwheel') == 'on' ? true : false), 'searchRadius' => array('min' => listify_theme_mod('map-behavior-search-min'), 'max' => listify_theme_mod('map-behavior-search-max'), 'default' => listify_theme_mod('map-behavior-search-default'))); if ('' != ($center = listify_theme_mod('map-behavior-center'))) { $settings['mapOptions']['center'] = array_map('trim', explode(',', $center)); } if (has_filter('job_manager_geolocation_region_cctld')) { $settings['autoComplete']['componentRestrictions'] = array('country' => $bias); } $settings = apply_filters('listify_map_settings', $settings); wp_localize_script('listify-app-map', 'listifyMapSettings', apply_filters('listify_map_settings', $settings)); }
function listify_get_color_scheme() { $scheme = listify_theme_mod('color-scheme'); $schemes = listify_get_color_schemes(); return $schemes[$scheme]; }
public function job_manager_get_listings_custom_filter_rss_args($args) { if (listify_theme_mod('categories-only')) { unset($args['job_types']); } return $args; }
public function accent() { $this->css->add(array('selectors' => array('.type-product .onsale', '.type-product .price ins', '.job-package-tag'), 'declarations' => array('background-color' => listify_theme_mod('color-accent')))); $this->css->add(array('selectors' => array('.woocommerce-tabs .tabs .active a'), 'declarations' => array('color' => listify_theme_mod('color-accent')))); }
public function accent() { $this->css->add(array('selectors' => array('.button[name=apply_coupon]', '.type-product .onsale', '.type-product .price ins', '.job-package-tag'), 'declarations' => array('background-color' => listify_theme_mod('color-accent')))); $this->css->add(array('selectors' => array('.button[name=apply_coupon]:hover'), 'declarations' => array('background-color' => $this->css->darken(listify_theme_mod('color-accent'), -5)))); $this->css->add(array('selectors' => array('.woocommerce-tabs .tabs .active a'), 'declarations' => array('color' => listify_theme_mod('color-accent')))); }
<a href="#" class="navigation-bar-toggle"> <i class="ion-navicon-round"></i> <?php echo listify_get_theme_menu_name('primary'); ?> </a> <div class="navigation-bar-wrapper"> <?php wp_nav_menu(array('theme_location' => 'primary', 'container_class' => 'primary nav-menu', 'menu_class' => 'primary nav-menu')); wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'secondary nav-menu', 'menu_class' => 'secondary nav-menu')); ?> </div> <?php if (!listify_has_integration('facetwp') && listify_theme_mod('nav-search')) { ?> <a href="#search-navigation" data-toggle="#search-navigation" class="ion-search search-overlay-toggle"></a> <div id="search-navigation" class="search-overlay"> <?php locate_template(array('searchform-header.php', 'searchform.php'), true, false); ?> <a href="#search-navigation" data-toggle="#search-navigation" class="ion-close search-overlay-toggle"></a> </div> <?php } ?> </div> </nav><!-- #site-navigation --> </header><!-- #masthead -->
<a href="#" class="navigation-bar-toggle"> <i class="ion-navicon-round"></i> <?php echo listify_get_theme_menu_name('primary'); ?> </a> <div class="navigation-bar-wrapper"> <?php wp_nav_menu(array('theme_location' => 'primary', 'container_class' => 'primary nav-menu', 'menu_class' => 'primary nav-menu')); wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'secondary nav-menu', 'menu_class' => 'secondary nav-menu')); ?> </div> <?php if (listify_theme_mod('nav-search')) { ?> <a href="#search-navigation" data-toggle="#search-navigation" class="ion-search search-overlay-toggle"></a> <div id="search-navigation" class="search-overlay"> <?php locate_template(array('searchform-header.php', 'searchform.php'), true, false); ?> <a href="#search-navigation" data-toggle="#search-navigation" class="ion-close search-overlay-toggle"></a> </div> <?php } ?> </div> </nav><!-- #site-navigation --> </header><!-- #masthead -->
public function search_icon($items, $args) { if ('primary' != $args->theme_location || !listify_theme_mod('nav-search')) { return $items; } if (listify_has_integration('facetwp')) { return '<li class="menu-item menu-type-link"><a href="' . get_post_type_archive_link('job_listing') . '" class="search-overlay-toggle"></a></li>' . $items; } else { return '<li class="menu-item menu-type-link"><a href="#search-header" data-toggle="#search-header" class="search-overlay-toggle"></a></li>' . $items; } }
/** * Get the active style switcher state * * @since Listify 1.0.0 * * @return string $style */ public function get_archive_display_style() { $default = listify_theme_mod('listing-archive-display-style'); if (is_user_logged_in()) { $style = get_user_meta(get_current_user_id(), 'listify_archive_style', true); } else { $style = isset($_COOKIE['listify_archive_style']) ? $_COOKIE['listify_archive_style'] : false; } return apply_filters('listify_archive_display_style', $style ? $style : $default); }
public function add_css() { $css = new Listify_Customizer_CSS(); $css->add(array('selectors' => array('.primary.nav-menu .current-cart .current-cart-count'), 'declarations' => array('border-color' => listify_theme_mod('color-header-background')))); }
public function get_color_scheme() { return listify_theme_mod('map-appearance-scheme'); }