How to setup cron jobs in wordpress using right method?

Cron job is use for reminder related functionalities

Add this code in your wp-config.php

Add this this your cpanel command

Important part is url. You should set url in cron setup with ?doing_wp_cron
Suppose your url is http://yourdomain.com, then wordpress cron will be

http://yourdomain.com/wp-cron.php?doing_wp_cron

Add Pure Javascript Ajax in wordpress with preloader

<style type=”text/css”>
.rj_form{
position:relative;
}
.rj_form_preloader{
display:none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255,255,255,0.7);
text-align: center;
vertical-align: middle;
}
.rj_form_preloader span{

position: absolute;
top: 50%;
transform: translateY(-50%);
}
.rj_form[data-form-status=”submiting”]{

}
.rj_form[data-form-status=”submiting”] .rj_form_preloader{

display:block;
}
.rj_form[data-form-status=”submitted”] .rj_form_preloader{
display:none;
}
</style>
<script type=”text/javascript”>
var form = document.querySelector(‘.exam_questions_form’);
form.addEventListener(‘submit’,function(ev){
ev.preventDefault();
form.setAttribute(‘data-form-status’,’submiting’);
var formData = new FormData(form);

var r = new XMLHttpRequest();
r.open(“POST”, “<?php echo admin_url(‘admin-ajax.php’); ?>”, true);
r.onreadystatechange = function () {
if (r.readyState != 4 || r.status != 200) return;

form.setAttribute(‘data-form-status’,’submitted’);
console.log(r.responseText);
};
r.send(formData);
return false;
});

</script>

Add above code in your index.php file

<?php
add_action( ‘wp_ajax_get_course_result’, ‘my_action_callback’ );
add_action( ‘wp_ajax_nopriv_get_course_result’, ‘my_action_callback’ );
function my_action_callback(){
echo 1;
die(0);
}

Add above code in your functions.php file.

 

How to write AJAX using pure Javascript


var form = document.querySelector('.exam_questions_form');
form.addEventListener('submit',function(ev){
ev.preventDefault();
var formData = new FormData(form);

var r = new XMLHttpRequest();
r.open(“POST”, “path/to/api”, true);
r.onreadystatechange = function () {
if (r.readyState != 4 || r.status != 200) return;
alert(“Success: ” + r.responseText);
};
r.send(formData);
return false;
});
In WordPress

add_action( 'wp_ajax_my_action', 'my_action_callback' );
add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' );
function my_action_callback(){
echo 1;
die(0);
}

Admin URL in wordpress

<?php echo admin_url(‘admin-ajax.php’); ?>

How to pass variables in included files in wordpress

include(locate_template('your-template-name.php'));

Change Default Title field in list-item in Metabox-UI

Filters

function rj_list_item_title_label( $label, $id ) {
if ( $id == ‘your_list_item_id’ ) {
$label = __( ‘Content Title’, ‘theme-domain’ );
}
return $label;
}
add_filter( ‘ot_list_item_title_label’, ‘rj_list_item_title_label’, 10, 2 );


function ot_list_item_title_desc( $description, $id ) {
if ( $id == ‘your_list_item_id’ ) {
$description= __( ‘Description’, ‘theme-domain’ );
}
return $description;
}
add_filter( ‘ot_list_item_title_desc’, ‘ot_list_item_title_desc’, 10, 2 );


function ot_list_item_title_type( $type, $id ) {
if ( $id == ‘your_list_item_id’ ) {
$type= 'text';
}
return $type;
}
add_filter( ‘ot_list_item_title_type’, ‘ot_list_item_title_type’, 10, 2 );

Add this code in your themes functions.php file

The uploaded file exceeds the upload_max_filesize directive in php.ini.

Add this into your php.ini file or create a new php.ini file and add this code.
max_execution_time = 259200;
max_input_time = 259200;
memory_limit = 1000M;
upload_max_filesize = 750M;
post_max_size = 750M;

Note: change values as per your requirements

Remove extensions from url using .htacess

Remove Extensions from url using .htacess

Remove .php from url using .htacess

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ $1.php

Remove .html from url using .htacess
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ $1.html

Fix HTTP Error

Add this code in your functions.php file
add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}

MetaboxUI Pro

MetaboxUI Pro can manage all your metaboxes, custom fields, custom taxonomy fields, custom profile fields,  and widgets. MetaboxUI Pro’s most awesome feature is the widget creation tool. MetaboxUI Pro allows you to create widgets without writing any code.

View product or Purchase now to experiance the awesome powerful feature

if you have any queries, please email admin@rajilesh.in

What is wordpress??

A blogging software. Nooooooooo!!!!! It is everything….