Created
May 24, 2017 16:38
-
-
Save tripflex/d6590ed91d58a415198d7ea6e0352890 to your computer and use it in GitHub Desktop.
Custom PHP code to generate a custom link from WP Job Manager Field Editor field, with the field value in query args for the link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$candidate_name = get_custom_field( 'candidate_name' ); | |
if ( ! empty( $candidate_name ) ) { | |
$some_url = 'http://somedomain.com/'; | |
$search_url = add_query_arg( | |
array( | |
'candidate_name' => $candidate_name, | |
), | |
$some_url | |
); | |
// If the value from candidate_name was 'John', the code above essentially creates this URL: | |
// http://somedomain.com/?candidate_name=John | |
echo "<a class=\"some-custom-class\" href=\"{$some_url}\" target=\"_blank\">Some Link</a>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment