wordpress get domain
// WORDPRESS GET SITE URL:
echo get_site_url(); // echo's http://www.yoursitename.com
wordpress get domain
// WORDPRESS GET SITE URL:
echo get_site_url(); // echo's http://www.yoursitename.com
wordpress get template url
// Get template directory example:
<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" />
// If you use child theme you will have to use another function:
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png" />
wordpress ajax url
<?php
add_action( 'wp_footer', 'my_ajax_without_file' );
function my_ajax_without_file() { ?>
<script type="text/javascript" >
jQuery(document).ready(function($) {
ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ) ?>'; // get ajaxurl
var data = {
'action': 'frontend_action_without_file', // your action name
'variable_name': "Some value" // some additional data to send
};
jQuery.ajax({
url: ajaxurl, // this will point to admin-ajax.php
type: 'POST',
data: data,
success: function (response) {
console.log(response);
}
});
});
</script>
<?php
}
add_action("wp_ajax_frontend_action_without_file" , "frontend_action_without_file");
add_action("wp_ajax_nopriv_frontend_action_without_file" , "frontend_action_without_file");
function frontend_action_without_file(){
echo json_encode($_POST);
wp_die();
}
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us