gistfile1.php if( ! function_exists( ‘wp_date_format_php_to_js’) ){ /** * Convert a date format to a jQuery UI DatePicker format * * @param string $dateFormat a date format * * @return string */ function wp_date_format_php_to_js( $dateFormat ) { $chars = array( // Day ‘d’ => ‘dd’, ‘j’ => ‘d’, ‘l’ => ‘DD’, ‘D’ => ‘D’, // Month […]
Output image thumbnail with link to full size image
gistfile1.phtml<?php $sample_gallery_images = get_custom_field( ‘sample_gallery_images’ ); // If field value is empty don’t output anything if( ! empty( $sample_gallery_images ) && function_exists( ‘job_manager_get_resized_image’ ) ){ // If it’s an array that means there are multiple images if( is_array( $sample_gallery_images ) ){ foreach( $sample_gallery_images as $gallery_image ){ $thumbnail_image = job_manager_get_resized_image( $gallery_image, ‘thumbnail’ ); // This outputs […]
Set default phone field type flag to South African
phone.min.jsjQuery(function(a){a(".jmfe-phone").intlTelInput({ defaultCountry: "za" })});
Output multiple file upload images with links
gistfile1.phtml<?php $sample_gallery_images = get_custom_field( ‘sample_gallery_images’ ); // If field value is empty don’t output anything if( ! empty( $sample_gallery_images ) ){ // If it’s an array that means there are multiple images if( is_array( $sample_gallery_images ) ){ foreach( $sample_gallery_images as $gallery_image ){ // This outputs an image with a link to the image itself with […]
Output image if checkbox is checked example
gistfile1.phtml<?php $huntfish_license = get_custom_field(‘huntfish_license’); if( (int) $huntfish_license === 1 ): ?> <a href="" target="_blank"><img src="huntfish_license.png" /></a> <?php endif; ?>
Set telephone field type to default to UK country code
gistfile1.jsjQuery(function(a){a(".jmfe-phone").intlTelInput({ defaultCountry: "gb" })});
Output multiple file upload images
gistfile1.phtml<?php $realisations = get_custom_field( ‘candidate_realisation’ ); if( ! empty( $realisations ) ){ foreach( $realisations as $realisation ){ echo ‘<img src="’ . $realisation . ‘" class="_candidate_realisation" />’; } } ?>
multi-select custom field as bulleted list ( foreach and implode examples )
foreach.php// Start UL (Unordered List) echo "<ul>"; // Get the field value $amenities = get_custom_field( ‘job_amentities’ ); // Make sure there is a value if( ! empty( $amentities ) ){ // An Array would be multiple selections if( is_array( $amentities ) ){ // Loop through each one and output it in a LI (List Item) […]
Job Category output on listing
gistfile1.php<?php $categories = get_the_terms( get_the_ID(), ‘job_listing_category’ ); foreach ( $categories as $category ){ echo $category->name; } ?>
Convert date timestamp to any format with PHP
gistfile1.php<?php $date = "15-01-28"; $timestamp = strtotime( $date ); // See http://php.net/manual/en/function.date.php for available formats echo date( "F j, Y", $timestamp ); ?>