Retrieve select tag custom values from array and display them in current page with wp_query?

@Nick83, While I’m not trying to make the answer overly complicated, in order to do what you are attempting to do correctly I believe you’ll need to call WordPress via Ajax. My recommendation is the following: Create two ajax calls. The first gets the prices (without duplicates). The second takes whichever price the user chose … Read more

Insert Address fields into function

Insert Address fields into function <?php function getCoordinates($address) { $address = urlencode($address); // set HTTP header $headers = array(‘Content-Type: application/json’); // Open connection $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, ‘http://maps.google.com/maps/api/geocode/json?sensor=false&address=” . $address); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // Execute request $result = curl_exec($curl); // Close connection curl_close($curl); // get the result and parse to JSON … Read more

Front end register with custom fields

With the help of something @TurtleTread said, I managed to get it working. My code was fine except had to change two things. I removed the custom field from my $user_data, and added this after right after wp_insert_user — add_user_meta($user_id, ‘broker_email’, $b_email); Here’s my final code in my functions.php file — add_action(‘template_redirect’, ‘register_a_user’); function register_a_user(){ … Read more

Query posts using less than

How about something like this? $args = array( ‘date_query’ => array( array( ‘before’ => array( ‘year’ => 2013, ‘month’ => 2, ‘day’ => 28, ), ‘inclusive’ => true, ), ), ‘posts_per_page’ => -1, ); $query = new WP_Query( $args ); Obviously you could set the exact date from a variable. More info: https://codex.wordpress.org/Class_Reference/WP_Query

Best way to contruct a global custom field?

I would use an option page which would show up in the settings. I used Example #2 from here for a few of my projects. Then you would use it in your theme like this: $o = get_option(‘my_option_name’); // how you named the options from Example #2 $field = $o[‘field_name’]; // how you named the … Read more

Pass PHP through redirect and custom fields

Without touching rewrites – you could probably do somthing like website.com/?goto-amazon=<?php echo get_the_ID() ?> Which’ed output website.com/?goto-amazon=42 Where 42 is an example of a post that contains the amazon_keywords. In your site you could listen for the goto-amazon query and redirect thereafter add_action( ‘init’, function(){ if (isset($_GET[‘goto-amazon’])) { $keywds = get_field(‘amazon_keywords’,intval($_GET[‘goto-amazon’])); $link = “http://www.amazon.co.uk/s/?_encoding=UTF8&camp=1634&creative=19450&field-keywords={$keywds}&linkCode=ur2&tag=AFFID”; wp_redirect($link); … Read more