• Resolved giantoctogon

    (@giantoctogon)


    I’ve been trying to replace the “date posted” info with the job expiry on the job listing page.
    I have tried the code recommended but have not had any success:

    get_post_meta( $job_id, '_job_expires', true );

    If anyone has managed to do this please let me know!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,
    It should work.

    Try this:

    get_post_meta( $post->ID, '_job_expires', true )

    Thread Starter giantoctogon

    (@giantoctogon)

    Hey Kibus90 – thanks so much for the reply.

    Still no luck though I’m afraid 🙁

    Is there perhaps something I’m doing wrong if it should work?
    I’m sort of figuring it out as I go along..

    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly.
    }
    
    global $post;
    ?>
    <li <?php job_listing_class(); ?> data-longitude="<?php echo esc_attr( $post->geolocation_lat ); ?>" data-latitude="<?php echo esc_attr( $post->geolocation_long ); ?>">
    	<a href="<?php the_job_permalink(); ?>">
    		<?php the_company_logo(); ?>
    		<div class="position">
    			<h3><?php wpjm_the_job_title(); ?></h3>
    		</div>
    		
    		<div class="company">
    				<?php the_company_name( '', '' ); ?>
    				<?php the_company_tagline( '<span class="tagline">', '</span>' ); ?>
    			</div>
    		
    		<div class="categorysum">
    			<?php the_terms( $post->ID, 'job_listing_category' ); ?>
    		</div>
    		
    		<div class="location">
    		    <span class="truncate">
    			<?php the_job_location( false ); ?>
    			</span>
    		</div>
    		<ul class="meta">
    			<?php do_action( 'job_listing_meta_start' ); ?>
    
    			<?php if ( get_option( 'job_manager_enable_types' ) ) { ?>
    				<?php $types = wpjm_get_the_job_types(); ?>
    				<?php if ( ! empty( $types ) ) : foreach ( $types as $type ) : ?>
    					<li class="job-type <?php echo esc_attr( sanitize_title( $type->slug ) ); ?>"><?php echo esc_html( $type->name ); ?></li>
    				<?php endforeach; endif; ?>
    			<?php } ?>
    
    			<li class="date"><?php get_post_meta( $post->ID, '_job_expires', true ) ?></li>
    
    			<?php do_action( 'job_listing_meta_end' ); ?>
    		</ul>
    	</a>
    </li>
    

    Hello @giantoctogon

    We forgot add “echo” 🙂

    Just use it:
    <?php echo get_post_meta( $post->ID, '_job_expires', true );?>

    • This reply was modified 7 years, 3 months ago by kibus90.
    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi @giantoctogon , when you say:

    I have tried the code recommended but have not had any success:

    Where did you see this recommendation?

    Plugin Contributor Richard Archambault

    (@richardmtl)

    I’m marking this thread as Resolved as it’s been more than a month since the last reply. If you still need help, please do reply again and mark the thread as Unresolved!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Replacing “Post Date” with “Expiry Date”’ is closed to new replies.