Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Forum: Plugins
    In reply to: [WooCommerce] Fatal Errors
    lmartin717

    (@lmartin717)

    Thanks, James – I just tried this and it seems to work. I ended up changing all instances of $woocommerce->nonce_field to ‘wp_nonce_field’ as well.

    lmartin717

    (@lmartin717)

    I am getting a similar error. I haven’t updated anything. Things seemed fine about a week ago.

    Fatal error: Call to undefined method WooCommerce::show_messages() in /home/xxx/public_html/wp-content/themes/x/woocommerce/myaccount/form-edit-address.php on line 17

    Thread Starter lmartin717

    (@lmartin717)

    Resolved. A+++ ??

    Thread Starter lmartin717

    (@lmartin717)

    Great – thanks for your quick reply!

    It looks like I had it configured incorrectly. It seems to be working-ish now for the most part – it looks like I need to configure my sandbox account for Pro, and then hopefully I’ll be good to go.

    I’ll let you know if I run into anything else.

    Thanks again for your time and help – I truly appreciate it!

    -Lisa

    Sure – sorry for the delay. Here are some reference links:

    https://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post-types
    and
    https://codex.www.ads-software.com/Plugin_API/Action_Reference/manage_posts_custom_column

    And the sample code I used (you can replace _job_jobOrderNumber with whatever your custom field is). Note that in order for this to work, you will still need to add the field (https://github.com/mikejolley/WP-Job-Manager/wiki/Editing-Job-Submission-Fields) before you reference it like it is below. I added some customization in my function because I wanted to switch the order of the columns and remove some existing columns. The first link above (justintadlock) is a really good reference for customization options. Let me know if you have any questions:

    add_filter('manage_edit-job_listing_columns' , 'add_job_listing_columns');
    add_action( 'manage_job_listing_posts_custom_column' , 'custom_columns', 10, 2 );
    
    function add_job_listing_columns($columns) {
    	$new = array();
      	foreach($columns as $key => $title) {
        		if ($key=='company') // Put the Job Order Number column before the Company column
          			$new['_job_jobOrderNumber'] = 'Job Order Number';
    		if ($key !== 'filled' && $key!== 'job_expires')  // Remove Filled and Expires columns
        			$new[$key] = $title;
      	}
      	return $new;
    }
    
    function custom_columns( $column, $post_id ) {
        switch ( $column ) {
    	case '_job_jobOrderNumber' :
    		$orderNumber = get_post_meta( $post_id, '_job_jobOrderNumber', false);
    		echo __( $orderNumber[0] );
    		break;
        }
    }

    I put mine in the job listings, but if you write those 2 functions in wp-job-manager-template.php, you should be able to call “the_jobOrderNumber();” (or “the_salary();” or whatever your custom field is) on any front-end page.

    Note that this is different than if you want the new field to show up in the job listings on the admin back-end. If you’re looking to put it on the page that has this at the end of the URL:
    wp-admin/edit.php?post_type=job_listing

    ..let me know, because that is different code entirely. I just figured it out yesterday so I can post that too if that’s what you’re looking for.

    I just figured this out today. Try going to wp-job-manager-template.php and add the 2 following functions. Just replace “jobOrderNumber” with “salary” or the name of your custom field.

    function the_jobOrderNumber( $before = '', $after = '', $echo = true, $post = null ) {
    	$jobOrderNumber = get_the_jobOrderNumber( $post );
    
    	if ( strlen( $jobOrderNumber ) == 0 )
    		return;
    
    	$jobOrderNumber = esc_attr( strip_tags( $jobOrderNumber ) );
    	$jobOrderNumber = $before . $jobOrderNumber . $after;
    
    	if ( $echo )
    		echo " ($jobOrderNumber)";
    	else
    		return $jobOrderNumber;
    }
    
    /**
     * get_the_jobOrderNumber function.
     *
     * @access public
     * @param int $post (default: null)
     * @return void
     */
    function get_the_jobOrderNumber( $post = null ) {
    	$post = get_post( $post );
    	if ( $post->post_type !== 'job_listing' )
    		return;
    
    	return apply_filters( 'the_job_OrderNumber', $post->_job_jobOrderNumber, $post );
    }

    Now in content-job-listing.php, you can use your new the_jobOrderNumber(); function, such as:

    <li <?php job_listing_class(); ?>>
    	<a href="<?php the_job_permalink(); ?>">
    		<?php the_company_logo(); ?>
    		<div class="position">
    			<h3><?php the_title();
    				if (is_user_logged_in()) {
    					the_jobOrderNumber();
    				}
    			?>
    			</h3>
    			<div class="company">
    				<?php the_company_name( '<strong>', '</strong> ' ); ?>
    				<?php the_company_tagline( '<span class="tagline">', '</span>' ); ?>
    			</div>
    		</div>
    		<div class="location">
    			<?php the_job_location( false ); ?>
    		</div>
    		<ul class="meta">
    			<li class="job-type <?php echo get_the_job_type() ? sanitize_title( get_the_job_type()->slug ) : ''; ?>"><?php the_job_type(); ?></li>
    			<li class="date"><date><?php echo human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'job_manager' ); ?></date></li>
    		</ul>
    	</a>
    </li>

    Hope this helps. Let me know how it works out.

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