Forums › Forums › Search & Filter Pro › PHP Function for External Project URL?
Tagged: external project url, php, variable
- This topic has 1 reply, 2 voices, and was last updated 7 years, 3 months ago by Trevor.
-
Anonymous(Private) August 30, 2017 at 11:37 am #128255
Hey!
I’m in the process of customizing the results of my Search & Filter results from within
public_html/wp-content/themes/salient/search-filter/results.php
. I see a number of PHP variables for various portfolio attributes, such asthe_title()
for the title andthe_excerpt()
for the excerpt. But I can’t seem to find the PHP variable for the External Project URL. I’ve made a few attempts (the_external_project_url()
,the_external_url()
, etc.) but haven’t gotten anything to work.What is the PHP variable for the External Project URL attribute of a Portfolio item?
Trevor(Private) August 30, 2017 at 12:45 pm #128266As I have not seen this requested before, can I assume that you have portfolio items, maybe as a Custom Post Type, and one field (probably a custom field) is the ‘external project URL’?
If that is so, it is probably a meta key. You can test this in your search form by adding a Post Meta object to the form, make it a dropdown select, find the meta key name from the list, make the choices a manual selection, not automatic (which is the default), and there is then a search button/function to find the values already stored. If they look right, then you have found the key name.
Then you need to use the standard WordPress codex method to call in a value for a custom field, like this:
<?php echo get_post_meta( get_the_ID(), 'external_project_url', true ); ?>
Depending on the actual key name. Note that fields made with specific plugins sometimes have different functions to retrieve the data, as does ACF for instance (using
get_field()
). -
AuthorPosts