How can I show a list of jobs posted by a specific user?

Hi,

I want to include a list of jobs listed by a specific user on a profile or author page.

This would be similar to how posts are displayed on the default author page for a specific user. The page I want to add these to is actually a custom profile template so will need code added to the template.

This is similar to how the admin system will filter jobs on the Manage Jobs page by username (after clicking on a username) e.g. /wp-admin/edit.php?post_type=jbp_job&author=1

Thanks
Chris

  • Anang

    Hi Chris

    Thanks for contacting us :slight_smile:

    There's no shortcode to displayed jobs list by owner. But you can also user Wordpress Query to get this list, since the Jobs & Expert plugin using Custom Post Type that you can get the data with default Wordpress Query.

    You may want to read about Wordpress Query here The 'post_type' for jobs is 'jbp_job'

    Let me know if you need any help about this query :slight_smile:

    Best Regards

  • chris

    Hi Anang,

    A little help would be really useful :

    I have a profile page that shows posts of a user.

    I want to change this page so it shows jobs instead:

    Could you please help to change template code below below to achieve this:

    <?php
    /**
     * WPUM Template: "Posts" profile tab.
     *
     * @package     wp-user-manager
     * @copyright   Copyright (c) 2015, Alessandro Tesoro
     * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
     * @since       1.0.0
     */
    
    // Query arguments
    $args = array( 'author' => $user_data->ID );
    
    // The Query
    $posts_query = new WP_Query( apply_filters( 'wpum_profile_posts_query_args', $args ) );
    ?>
    
    <div class="wpum-user-posts-list">
    
    	<!-- the loop -->
    	<?php 
    
    		if ( $posts_query->have_posts() ) :
    
    			while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
    
    				<div class="wpum-post" id="wpum-post-<?php echo the_id();?>">
    
    					<a href="<?php the_permalink();?>" class="wpum-post-title"><?php the_title();?></a>
    
    					<ul class="wpum-post-meta">
    						<li>
    							<strong><?php _e( 'Posted on:', 'wpum' ); ?></strong>
    							<?php echo get_the_date(); ?> -
    						</li>
    						<li>
    							<strong><?php _e( 'Comments:', 'wpum' ); ?></strong>
    							<?php comments_popup_link( __( 'No Comments', 'wpum' ), __( '1 Comment', 'wpum' ), __( '% Comments', 'wpum' ) ); ?>
    						</li>
    					</ul>
    
    				</div>
    
    			<?php endwhile;
    
    		else :
    
    			// Display error message
    			$args = array(
    				'id'   => 'wpum-posts-not-found',
    				'type' => 'notice',
    				'text' => sprintf( __( '%s did not submit any posts yet.', 'wpum' ), $user_data->display_name )
    			);
    			wpum_message( $args );
    
    		endif;
    
    		// Reset the original query - do not remove this.
    		wp_reset_postdata();
    
    	?>
    	<!-- end loop -->
    
    </div>

    Many thanks for you help on this.
    Chris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.