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

dynamic site link for future migration in echo do_shortcode()

You can save your website’s URL into a variable and pass it to the shortcode: $url = site_url(); echo do_shortcode(“[timeline src=”https://wordpress.stackexchange.com/questions/284281/$url/rest-of-the-url/”]”); You should also be able to use your shortcode in the following way: echo do_shortcode(“[timeline src=””.site_url().”/rest-of-the-url/”]”);

Proper Way to Load stylesheet on Condition

You’ll need to put the if statement around the line that enqueues in the first place. // enqueue styles for child theme function wowdental_enqueue_styles() { // enqueue parent styles wp_enqueue_style(‘Divi’, get_template_directory_uri() .’/style.css’, get_the_time() ); // Flip3d css // flip3d only on home page if( is_home() ) { wp_enqueue_style( ‘flip’, get_stylesheet_directory_uri() . ‘/css/flip.css’, get_the_time() ); } … Read more

Check from functions.php if function exists in footer.php

You should not declare functions in your templates. The templates are for outputting content. The function_exists() will check if the function is declared before the function_exists() call, not after it, and templates are loaded after functions.php file, since you can control them by using the template_redirect filter. Declare your function in your theme’s functions.php file, … Read more

processing form data with ajax

This way to insert data in db using AJAX works for me. Hope this help you. Function scripts function add_our_script() { wp_register_script( ‘ajax-js’, get_template_directory_uri() . ‘/scripts/keeled.js’, array( ‘jquery’ ), ”, true ); wp_localize_script( ‘ajax-js’, ‘ajax-js_ajax’, array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ) ) ); } add_action( ‘wp_enqueue_scripts’, ‘add_our_script’ ); Template Form: <form> <label for=”nimi”>Nimi</label> <input name=”nimi” … Read more

How to Add Shortcode to html img code?

You cannot use Shortcodes in attributes since 4.2.3, for security reasons. See the announcement (emphasis mine): Earlier today, we released WordPress 4.2.3, which includes a relatively large security fix that affects the Shortcode API. Due to the nature of the fix – as is often the case with security fixes – we were unable to … Read more

Need to convert image url to a Base_64 data url with wordpress function..

In your post you wrote : “which will show an image like below”, I assume that your shortcode return an img tag and you have to find your URL here, tell me if I’m wrong. Using DOMDocument http://php.net/manual/fr/class.domdocument.php to parse your img tag is a good idea. $img = do_shortcode(‘[user_meta_avatar_pic]’); // Here your get your … Read more