Exemplo n.º 1
0
    /**
     * 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;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '', $instance, $this->id_base);
        echo $before_widget;
        ?>

		<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

		<div class="job-type <?php 
        echo get_the_job_type()->slug;
        ?>
 term-<?php 
        echo get_the_job_type() ? sanitize_title(get_the_job_type()->term_id) : '';
        ?>
"><?php 
        the_job_type();
        ?>
</div>

		<?php 
        echo $after_widget;
        $content = apply_filters('jobify_widget_job_type', ob_get_clean(), $instance, $args);
        echo $content;
        $this->cache_widget($args, $content);
    }
>
  <<?php 
echo $header_tag;
?>
 class="entry-title"><?php 
the_title(sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a>');
?>
</<?php 
echo $header_tag;
?>
>
  <ul class="list-inline">
    <?php 
do_action('job_listing_meta_start');
?>
    <li class="job"><span class="label job-type <?php 
echo get_the_job_type() ? sanitize_title(get_the_job_type()->slug) : '';
?>
"><?php 
the_job_type();
?>
</span></li>
    <li class="date-posted" itemprop="datePosted"><i class="fa fa-calendar"></i> <date><?php 
printf(__('%s ago', 'wp-job-manager'), human_time_diff(get_post_time('U'), current_time('timestamp')));
?>
</date></li>
    <?php 
do_action('job_listing_meta_end');
?>
  </ul>
</li>
Exemplo n.º 3
0
/**
 * get_job_listing_class function.
 *
 * @access public
 * @return array
 */
function get_job_listing_class($class = '', $post_id = null)
{
    $post = get_post($post_id);
    if ($post->post_type !== 'job_listing') {
        return array();
    }
    $classes = array();
    if (empty($post)) {
        return $classes;
    }
    $classes[] = 'job_listing';
    $classes[] = 'job-type-' . sanitize_title(get_the_job_type()->name);
    if (is_position_filled($post)) {
        $classes[] = 'job_position_filled';
    }
    if (is_position_featured($post)) {
        $classes[] = 'job_position_featured';
    }
    return get_post_class($classes, $post->ID);
}
 /**
  * Add custom data to the job feed
  */
 public function job_feed_item()
 {
     $post_id = get_the_ID();
     $location = get_the_job_location($post_id);
     $job_type = get_the_job_type($post_id);
     $company = get_the_company_name($post_id);
     if ($location) {
         echo "<job_listing:location><![CDATA[" . esc_html($location) . "]]></job_listing:location>\n";
     }
     if ($job_type) {
         echo "<job_listing:job_type><![CDATA[" . esc_html($job_type->name) . "]]></job_listing:job_type>\n";
     }
     if ($company) {
         echo "<job_listing:company><![CDATA[" . esc_html($company) . "]]></job_listing:company>\n";
     }
 }
/**
 * get_job_listing_class function.
 *
 * @access public
 * @return array
 */
function get_job_listing_class($class = '', $post_id = null)
{
    $post = get_post($post_id);
    if ($post->post_type !== 'job_listing') {
        return array();
    }
    $classes = array();
    if (empty($post)) {
        return $classes;
    }
    $classes[] = 'job_listing';
    if ($job_type = get_the_job_type()) {
        $classes[] = 'job-type-' . sanitize_title($job_type->name);
    }
    if (is_position_filled($post)) {
        $classes[] = 'job_position_filled';
    }
    if (is_position_featured($post)) {
        $classes[] = 'job_position_featured';
    }
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    }
    return get_post_class($classes, $post->ID);
}
 /**
  * custom_columns function.
  *
  * @access public
  * @param mixed $column
  * @return void
  */
 public function custom_columns($column)
 {
     global $post, $job_manager;
     switch ($column) {
         case "job_listing_type":
             $type = get_the_job_type($post);
             if ($type) {
                 echo '<span class="job-type ' . $type->slug . '">' . $type->name . '</span>';
             }
             break;
         case "job_position":
             echo '<div class="job_position">';
             echo '<a href="' . admin_url('post.php?post=' . $post->ID . '&action=edit') . '" class="tips job_title" data-tip="' . sprintf(__('Job ID: %d', 'wp-job-manager'), $post->ID) . '">' . $post->post_title . '</a>';
             echo '<div class="location">';
             if (get_the_company_website()) {
                 the_company_name('<span class="tips" data-tip="' . esc_attr(get_the_company_tagline()) . '"><a href="' . get_the_company_website() . '">', '</a></span> &ndash; ');
             } else {
                 the_company_name('<span class="tips" data-tip="' . esc_attr(get_the_company_tagline()) . '">', '</span> &ndash; ');
             }
             the_job_location($post);
             echo '</div>';
             the_company_logo();
             echo '</div>';
             break;
         case "job_listing_category":
             if (!($terms = get_the_term_list($post->ID, $column, '', ', ', ''))) {
                 echo '<span class="na">&ndash;</span>';
             } else {
                 echo $terms;
             }
             break;
         case "filled":
             if (is_position_filled($post)) {
                 echo '&#10004;';
             } else {
                 echo '&ndash;';
             }
             break;
         case "featured_job":
             if (is_position_featured($post)) {
                 echo '&#10004;';
             } else {
                 echo '&ndash;';
             }
             break;
         case "job_posted":
             echo '<strong>' . date_i18n(__('M j, Y', 'wp-job-manager'), strtotime($post->post_date)) . '</strong><span>';
             echo (empty($post->post_author) ? __('by a guest', 'wp-job-manager') : sprintf(__('by %s', 'wp-job-manager'), '<a href="' . get_edit_user_link($post->post_author) . '">' . get_the_author() . '</a>')) . '</span>';
             break;
         case "job_expires":
             if ($post->_job_expires) {
                 echo '<strong>' . date_i18n(__('M j, Y', 'wp-job-manager'), strtotime($post->_job_expires)) . '</strong>';
             } else {
                 echo '&ndash;';
             }
             break;
         case "job_status":
             echo get_the_job_status($post);
             break;
         case "job_actions":
             echo '<div class="actions">';
             $admin_actions = array();
             if ($post->post_status == 'pending') {
                 $admin_actions['approve'] = array('action' => 'approve', 'name' => __('Approve', 'wp-job-manager'), 'url' => wp_nonce_url(add_query_arg('approve_job', $post->ID), 'approve_job'));
             }
             if ($post->post_status !== 'trash') {
                 $admin_actions['view'] = array('action' => 'view', 'name' => __('View', 'wp-job-manager'), 'url' => get_permalink($post->ID));
                 $admin_actions['edit'] = array('action' => 'edit', 'name' => __('Edit', 'wp-job-manager'), 'url' => get_edit_post_link($post->ID));
                 $admin_actions['delete'] = array('action' => 'delete', 'name' => __('Delete', 'wp-job-manager'), 'url' => get_delete_post_link($post->ID));
             }
             $admin_actions = apply_filters('job_manager_admin_actions', $admin_actions, $post);
             foreach ($admin_actions as $action) {
                 printf('<a class="button tips icon-%s" href="%s" data-tip="%s">%s</a>', sanitize_title($action['name']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
             }
             echo '</div>';
             break;
     }
 }
Exemplo n.º 7
0
 /**
  * Single listing alert link
  */
 public function single_alert_link()
 {
     global $post, $job_preview;
     if (!empty($job_preview)) {
         return;
     }
     if (is_user_logged_in() && get_option('job_manager_alerts_page_id')) {
         $job_type = get_the_job_type($post);
         $link = add_query_arg(array('action' => 'add_alert', 'alert_name' => urlencode($post->post_title), 'alert_job_type' => array($job_type->slug), 'alert_location' => urlencode(strip_tags(get_the_job_location($post))), 'alert_cats' => taxonomy_exists('job_listing_category') ? wp_get_post_terms($post->ID, 'job_listing_category', array('fields' => 'ids')) : '', 'alert_keyword' => urlencode($post->post_title), 'alert_region' => taxonomy_exists('job_listing_region') ? current(wp_get_post_terms($post->ID, 'job_listing_region', array('fields' => 'ids'))) : ''), get_permalink(get_option('job_manager_alerts_page_id')));
         echo '<p class="job-manager-single-alert-link"><a href="' . esc_url($link) . '">' . __('Alert me to jobs like this', 'wp-job-manager-alerts') . '</a></p>';
     }
 }