How to Custom Pagination For Custom Post in WordPress?

  There are very simple steps for Pagination for any type of Post in WordPress by Shortcode with Ajax.  Write this below code in you active WordPress theme’s funcntion.php file. ie: wp-contentthemestwentytwentyfunctions.php  Put this shortcode […]

Read More

How to create and manage log file in php?

Create and manage crud operation log data PHP <?phpfunction crud_log($action = ”,$message = ”,$array_data = array()){    global $handle_crud_log;    date_default_timezone_set(“Australia/Sydney”); //Ex. set australia/sydney timezone        $crud_log_dir […]

Read More

PHP Run Script For Specific IP Address

<?php// Write your IP instead of xxx.xxx.xxx.xxx if(@$_SERVER[‘REMOTE_ADDR’] == ‘xxx.xxx.xxx.xxx’|| @$_SERVER[‘HTTP_X_FORWARDED_FOR’] == ‘xxx.xxx.xxx.xxx’ ){    define( ‘TESTINGMOD’,TRUE);}else{    define( ‘TESTINGMOD’,FALSE);} if(TESTINGMOD){    error_reporting(E_ALL);    ini_set(‘display_errors’, 1);    // Write test […]

Read More

How to prevent SQL injection in PHP?

<?php$con = mysqli_connect(“localhost”,”my_user”,”my_password”,”my_db”);// Check connectionif (mysqli_connect_errno()) {  echo “Failed to connect to MySQL: ” . mysqli_connect_error();}if ($_SERVER[“REQUEST_METHOD”] == “POST”) {    //unsafe data    $unsafe_name = mysqli_real_escape_string($con, […]

Read More

How to connect to mysqli database in php?

Create connection.php file and include all CRUD operation’s file for connect database. <?phperror_reporting(0);$DB_HOST = ‘localhost’;$DB_USER = ‘root’; $DB_PASS = ”;$DB_NAME =  ‘mysql’;$conn = mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME);// Check […]

Read More

How to define an empty object in PHP?

<?php        $ObjAraay = new stdClass();    $ObjAraay->fname = “PHP”;    $ObjAraay->lname = “Beginner”;     echo “<pre>”;    print_r($ObjAraay);    echo “</pre>”;?> Result: 

Read More