Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created September 14, 2018 08:30
Show Gist options
  • Save yousufansa/0a8b027ad3832c1423b0935251b08692 to your computer and use it in GitHub Desktop.
Save yousufansa/0a8b027ad3832c1423b0935251b08692 to your computer and use it in GitHub Desktop.
Jobhunt add Instagram to single company
add_filter('jobhunt_submit_job_form_company_fields' , 'jobhunt_custom_submit_job_form_company_fields');
if ( ! function_exists( 'jobhunt_custom_submit_job_form_company_fields' ) ) {
function jobhunt_custom_submit_job_form_company_fields ($fields) {
$fields['company_instagram'] = array(
'label' => esc_html__( 'Instagram', 'jobhunt' ),
'type' => 'text',
'required' => false,
'placeholder' => esc_html__( 'Instagram url', 'jobhunt' ),
'priority' => 5,
);
return $fields;
}
}
add_filter('jobhunt_submit_company_form_required_fields' , 'jobhunt_submit_custom_company_form_required_fields');
if ( ! function_exists( 'jobhunt_submit_custom_company_form_required_fields' ) ) {
function jobhunt_submit_custom_company_form_required_fields ($required_fields) {
$required_fields['meta_fields'][] = 'company_instagram';
return $required_fields;
}
}
add_filter('company_manager_company_fields' , 'jobhunt_custom_company_manager_company_fields');
if ( ! function_exists( 'jobhunt_custom_company_manager_company_fields' ) ) {
function jobhunt_custom_company_manager_company_fields ($fields) {
$fields['_company_instagram'] = array(
'label' => esc_html__( 'Instagram', 'jobhunt-extensions' ),
'placeholder' => esc_html__( 'company Instagram page link', 'jobhunt-extensions' ),
);
return $fields;
}
}
if ( ! function_exists( 'the_company_instagram_page' ) ) {
function the_company_instagram_page( $post = null ) {
if ( ! empty( get_the_company_instagram_page( $post ) ) ) {
echo '<a href="' . esc_url( get_the_company_instagram_page( $post ) ) . '" class="company-instagram"><i class="fab fa-instagram"></i></a>';
}
}
}
if ( ! function_exists( 'get_the_company_instagram_page' ) ) {
function get_the_company_instagram_page( $post = null ) {
$post = get_post( $post );
if ( $post->post_type !== 'company' )
return;
if ( $post->_company_instagram && ! strstr( $post->_company_instagram, 'http:' ) && ! strstr( $post->_company_instagram, 'https:' ) ) {
$post->_company_instagram = 'https://' . $post->_company_instagram;
}
return $post->_company_instagram;
}
}
if ( ! function_exists( 'jobhunt_company_socail_network' ) ) {
function jobhunt_company_socail_network() {
if( ! empty( get_the_company_twitter_page() || get_the_company_facebook_page() || get_the_company_googleplus_page() || get_the_company_linkedin_page() || the_company_instagram_page() ) ) :
echo '<div class="social-network-pages">';
the_company_twitter_page();
the_company_facebook_page();
the_company_googleplus_page();
the_company_linkedin_page();
the_company_instagram_page();
echo '</div>';
endif;
}
}
.company-single-head__right .social-network-pages .company-instagram {
color: #fb3958;
border-color: #fb3958;
}
.company-single-head__right .social-network-pages .company-instagram:hover {
color: #fff;
background-color: #fb3958;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment