add_shortcode(‘display_companies’, ‘showproducts’);
function showproducts() {
$taxonomies = get_terms( array(
‘taxonomy’ => ‘job_company’,
‘hide_empty’ => false,
‘parent’ => 0,
) );
$i = 1;
echo '<section class="companylogo">';
foreach ( $taxonomies as $taxonomy ) {
$blues = ($i % 3 == 0)?'blues':'';
$i++;
if (function_exists('get_wp_term_image'))
{
$meta_image = get_wp_term_image($taxonomy->term_id);
}
$pimage = get_term_meta($taxonomy->term_id, ‘bgimage’, true);
$pimages = wp_get_attachment_image_src($pimage, ‘full’);
$pimagelogo = get_term_meta($taxonomy->term_id, 'white_logo', true);
$pimagelogos = wp_get_attachment_image_src($pimagelogo, ‘full’);
echo ‘
echo '<div class="companylist"> <a href="'.home_url().'/job_company/'.$taxonomy->slug.'"> <div class="sec-cont">
<h3>'.$taxonomy->name.'</h3>
Browse Jobs
</div><div class="sec-thumb">
<img src="'. $pimages[0].'" />
</div>
<div class="sec-logos">
<img src="'. $pimagelogos[0].'" />
</div>
';
echo '</a>';
echo '</div></div>';
}
echo ”;
echo ”;
}
function job_search_function() {
$message = ‘
‘;
return $message;
}
add_shortcode(‘custom_job_search’, ‘job_search_function’);
function job_company_posts( $query ) {
if( is_tax( ‘job_company’ ) ) {
$query->set(‘posts_per_page’, ’10’);
$query->set(‘paged’, get_query_var(‘paged’) ? get_query_var(‘paged’) : 1);
}
return $query;
}
add_filter(‘pre_get_posts’, ‘job_company_posts’);
function wpdocs_custom_excerpt_length( $length ) {
return 33;
}
add_filter( ‘excerpt_length’, ‘wpdocs_custom_excerpt_length’, 999 );
add_action( ‘save_post’, ‘update_jobref’);
function update_jobref( $id ){
if( get_post_status( $id ) == ‘publish’ ) {
$pad_length = 4;
$pad_char = 0;
$job_refstr = str_pad($id, $pad_length, $pad_char, STR_PAD_LEFT);
update_post_meta( $id, ‘job_refer’, $job_refstr );
}
}