Slug/permalink structure
-
Hi,
how to set permalink as: https://mysite.com/job/jobtitle-location and not as https://mysite.com/job/location-jobtitle
another question is how to show job listing count by user/author on frontend dashboard?
Thanks
-
https://wpjobmanager.com/document/tutorial-changing-the-job-slugpermalink/#section-2
another question is how to show job listing count by user/author on frontend dashboard?
Customise whatever adds the user/author and use http://codex.wordpress.org/Function_Reference/count_user_posts
Hi, Thanks for reply, but this is not working. Actually this generates slug like this https://mysite.com/job/location-jobtitle but i need jobtitle first and location last in slug.
And for job listing count i am unable to figure it out. my code is <p class=”author-meta”>
<span class=”listing-count”><?php printf(
_n( ‘%d Jobs Created’, ‘%d Jobs Created’, $wp_query->found_posts, ‘text-domain’ ),
$wp_query->found_posts );
?></span>but it is not working. please help.
I know the snippet isn’t exactly how you asked – you have to modify it and re-aarrange the contents.
As for the other function, you’ve not even used the function I suggested. count_user_posts gets the count of jobs a specific user has posted.
Alright. I have tried several times to modify it but did not get exactly what i want. please can you re-arrenge it for me? Thanks.
Show me your latest attempt 🙂
Hi, I have Succeeded in getting user post count. this worked for me:
<p class=”author-meta”>
<span class=”listing-count”><?php printf( __( ‘%d Listing Created’, ‘wp-job-manager’ ), count_user_posts($current_user_id = get_current_user_id(), “job_listing” ) ); ?></span></p>But with slug structure i failed.
I tried:
add_filter( ‘submit_job_form_save_job_data’, ‘custom_submit_job_form_save_job_data’, 10, 5 );
function custom_submit_job_form_save_job_data( $data, $post_title, $post_content, $status, $values ) {
$job_slug = array();
$job_slug[] = $post_title;
$data[‘post_name’] = implode( ‘-‘, $job_slug );// Prepend location
if ( ! empty( $values[‘job’][‘job_location’] ) )
$job_slug[] = $values[‘job’][‘job_location’];return $data;
}Hi, one more issue: with 10k categories, very slow database queries causing db errors or endless site loading. Using VPS with 2gb ram.
What DB errors? There will be optimisations in the next update, but it may be something else if you get actual errors.
$job_slug = array(); $job_slug[] = $post_title; if ( ! empty( $values['job']['job_location'] ) ) { $job_slug[] = $values['job']['job_location']; } $data['post_name'] = implode( '-', $job_slug );Hi, Thanks, but this is not working. It is generating only http://myssite.com/jobtitle
but i need http://myssite.com/jobtitle-lication/
due to slow my sql queries site loading endless.
SELECT t.*, tt.*
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt
ON t.term_id = tt.term_id
WHERE tt.taxonomy IN (‘job_listing_categories’)
ORDER BY t.name ASC W3_Db->default_query+ 0.0811
$wpdb Queries0.08 is not a slow query.
Remember this code only affects new listings submitted from the frontend form. Not the admin.
Ok but after disabling categories site works fine.
above slug snnipets is not working for me. It is generating only http://myssite.com/jobtitle
but i need http://myssite.com/jobtitle-lication/
Please help.
This works fine, its tested https://gist.github.com/mikejolley/8edf6429e265ee5cf715
Yes, Its working… You are my superhero. Many Thanks. 🙂
Just one issue with 10k categories slow database queries…
You are the man. Thank you Mike!
Could it be the select box where you select a category on the search/submission forms? This outputs all categories..
Could it be the select box where you select a category on the search/submission forms? This outputs all categories..
The topic ‘Slug/permalink structure’ is closed to new replies.