Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Richard Vencu

    (@rvencu)

    So, let do some hacking here.

    Because we want to publish resume for multiple people it is safe to consider those people are at least authors on the website, so we will use the post author meta to filter the ‘resume positions’. For this we need to pass the author ID to the query, so we change the function inside wp_resume.php like this

    function wp_resume_query( $section, $author = '' ) {
    
    	//build our query
    	$args = array(
    		'post_type' => 'wp_resume_position',
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'nopaging' => true,
    		'author' => $author,
    		'wp_resume_section' => $section,
    	);
    
    	//query and return
    	$query = new wp_query($args);
    	return $query;
    }

    Now we need a way to pass the author ID. I will use this approach: create an argument list with author attribute for the shortcode, so if the ID is passed as an attribute inside the shortcode then it is used directly. If there is no attribute then we will check the resume page author ID and we will pass that ID instead.

    I will come back with the required code soon.

    Thread Starter Richard Vencu

    (@rvencu)

    First, to use the host page author ID the above function becomes:

    function wp_resume_query( $section, $author = '' ) {
    
    	if(!$author) {
    		global $authordata;
    		if( is_object($authordata) )
    			$author = $authordata->ID;
    	}
    
    	//build our query
    	$args = array(
    		'post_type' => 'wp_resume_position',
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'nopaging' => true,
    		'author' => $author,
    		'wp_resume_section' => $section,
    	);
    
    	//query and return
    	$query = new wp_query($args);
    	return $query;
    }

    I will work the shortcode attribute another day since this is OK for me as it is now. Any author can create it’s own resume by creating a host page with the wp resume template, add the default shortcode and start adding resume positions.

    Thread Starter Richard Vencu

    (@rvencu)

    And a final mention: the hide_empty solution for sections with no entries does not work anymore now since a section may not be empty but for some users only.

    The solution is a little redesign of the template, by moving up the have_posts() test, resulting in something like this:

    <div class='resume'>
    	<div id='bar'>&nbsp;</div>
    	<div id='header'>
    		<h2><?php echo $options['title']; ?></h2>
    <?php 			echo $options['contact_info']; ?>
    	</div>
    <?php 		foreach ( wp_resume_get_sections() as $section) {
    		$posts = wp_resume_query( $section->slug );
    		if ( $posts->have_posts() ) {
    	?>
    	<div class="section" id="<?php echo $section->slug; ?>">
    		<div class="label"><?php echo $section->name; ?></div>
    <?php			$current_org='';
    		while ( $posts->have_posts() ) : $posts->the_post();
    		$organization = wp_resume_get_org( get_the_ID() );
    			if ($organization && $organization->term_id != $current_org) {
    				if ($current_org != '') { ?>
    		</div>
    <?php 				} $current_org = $organization->term_id; ?>
    		<div class="organization" id="<?php echo $organization->slug; ?>">
    			<div class="orgName"><?php echo $organization->name; ?></div>
    			<div class="location"><?php echo $organization->description; ?></div>
    <?php 				}  ?>
    			<div class="title"><?php echo the_title(); ?></div>
    			<div class="date"><?php echo wp_resume_format_date( get_the_ID() ); ?></div>
    			<div class="details">
    				<?php the_content(); ?>
    <?php 		if ( current_user_can( 'edit_posts' ) )
    		edit_post_link('Edit'); 	?>
    			</div><!-- .details -->
    <?php 		endwhile; 
    
    	?>
    <?php 		if ( $organization ) { ?>
    		</div><!-- .organization -->
    <?php 		} ?>
    	</div><!-- .section -->
    <?php 		} ?>
    <?php } ?>
    </div><!-- #resume -->
    Plugin Author Ben Balter

    (@benbalter)

    Great idea and great implementation.

    The default template changed a bit in 1.5 (mostly hResume classes and inline comments to make custom templating easier), but otherwise, should just be a matter of merging the two. I’ll work on getting this into the next version of the plugin.

    In the mean time (if you haven’t fixed it already) you may be able to use a custom template (just save your above code as resume.php in your template directory) to achieve the same functionality.

    Nice to hear that this suggestion is being worked on, as it’s a great one.

    Thanks!

    Plugin Author Ben Balter

    (@benbalter)

    Still working on a handful of bugs, but multiple resume support should be working (more or less) in the development version.

    Plugin Author Ben Balter

    (@benbalter)

    Here’s a link to the zip file in case you don’t use svn.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP Resume] Feature request – multiple resumes’ is closed to new replies.