akschoeck
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Job Manager] Automatically set default meta for new entriesSo I’m getting it to update the correct meta fields when creating a new entry, but it’s not reading the fields to put in there. Here is my function:
function update_yoast( $post_id ) { $focuskw = '_yoast_wpseo_focuskw'; $title = '_yoast_wpseo_title'; $metadesc = '_yoast_wpseo_metadesc'; $jobtitle = get_post_meta( $post_ID, '_job_title', true ); $city = get_post_meta( $post_ID, 'geolocation_city', true ); $shortstate = get_post_meta( $post_ID, 'geolocation_state_short', true ); $longstate = get_post_meta( $post_ID, 'geolocation_state_long', true ); update_post_meta($post_id, $focuskw, $jobtitle . ' in ' . $city . ', ' . $shortstate . ' - Darts Bar Databases'); update_post_meta($post_id, $title, 'Find hours, reviews, and info on ' . $jobtitle . ' and the best ' . $city . ', ' . $longstate . ' bars. Discover nearby darts leagues and tournaments.'); update_post_meta($post_id, $metadesc, $jobtitle . ' in ' . $city . ', ' . $shortstate); } add_action( 'save_post', 'update_yoast' );
Is
get_post_meta
not the correct function to use?Forum: Plugins
In reply to: [WP Job Manager] Add tags to post on job add/edit submissionThis one worked:
$day1 = get_post_meta( $post_ID, '_tournament1_day', true );
Thanks so much! Working like a charm now!
Forum: Plugins
In reply to: [WP Job Manager] Add tags to post on job add/edit submissionMaking baby steps with each of your suggestions, but I keep being unable to take it to the next step.
Here’s what I’m currently trying:
function update_tournaments( $post_ID ) { $day1 = get_custom_field ( 'tournament1_day' ); $day2 = get_custom_field ( 'tournament2_day' ); $day3 = get_custom_field ( 'tournament3_day' ); $tags = array($day1, $day2, $day3); wp_set_post_terms( $post_ID, $tags, 'job_listing_tag', false ); return $post_ID; } add_action( 'job_manager_update_job_data', 'update_tournaments' );
Also tried using
get_post_meta($post_ID, "tournament1_day", true);
instead ofget_custom_field
but that also did not work.
It successfully updates the post’s tags if I have the variable
$tags
set to an array of strings such as$tags = 'hello, goodbye'
. So I believe at this point my last issue is figuring out how to identify the $tags as the proper custom fields.Forum: Plugins
In reply to: [WP Job Manager] Add tags to post on job add/edit submissionSo I got the action hooked correctly, and the function is being called when I want it to. (Tested with the email example given here: https://codex.www.ads-software.com/Function_Reference/add_action, and I am receiving an email when updating the job post)
However, I am having more trouble with building the function than I thought. I cannot get the wp_set_post_tags function to work (https://codex.www.ads-software.com/Function_Reference/wp_set_post_tags).
I am trying something as simple as
function update_tournaments( $post_ID ) { wp_set_post_tags( 12993, '123', true ); $friends = '[email protected]'; wp_mail( $friends, $post_ID, 'test'); return $post_ID; } add_action( 'job_manager_update_job_data', 'update_tournaments' );
and it is still not working (I left the email in there for testing purposes).
Ultimately, I am going for something along the lines of
function update_tournaments( $post_ID ) { $day1 = get_custom_field ( 'tournament1_day' ); $day2 = get_custom_field ( 'tournament2_day' ); $day3 = get_custom_field ( 'tournament3_day' ); $tags = array($day1, $day2, $day3); wp_set_post_tags( $post_ID, $tags, true ); return $post_ID; } add_action( 'job_manager_update_job_data', 'update_tournaments' );
but wanted to start with something simple. Can’t test what I’ve created if I can’t even get a the simplest version working =\
Forum: Plugins
In reply to: [WP Job Manager] Making the admin able to bypass pendingI actually did previously try that as well (and just tried again). It also did not work. Still needed approval for submitting a job.
I think my client eventually wants to create some ‘trusted’ user roles to be able to post jobs without having access to the admin panel and without needing approval. I’m not 100% certain, just following orders right now. ??
Any other ideas on how to get this to work?
Forum: Themes and Templates
In reply to: Can't get the_excerpt() to workAha, I understand what you’re saying.
Took a little bit of a different approach and just replaced
<div class="blogContent"> <?php get_template_part( 'content', get_post_format() ); ?> </div>
with
<div class="blogContent"> <?php the_title( '<h3>', '</h3>' ); ?> <?php the_excerpt(); ?> </div>
and that worked as well. Thank you for the explanation!