Web development tutorials.

  • Get WP Post Meta Value Of A Given Meta Key

    Get WP Post Meta Value Of A Given Meta Key

    Get the post meta_value of a given meta_key in WordPress. You can also use this to get the value of a custom meta field of a post. Requirements: WordPress Syntax. get_post_meta( $post_id, $key, $single ); Where. $post_id ( int Required ) is the Post ID. $key ( string Optional ) is the meta_key to retrieve,…

    Read more

  • Create Your Own WP Post Views Counter

    Create Your Own WP Post Views Counter

    Create your own post views counter in WordPress with no plugin needed. Use the post meta field to store count views of a particular post, and increment it for every page hit. Requirements: WordPress 6.2 Step 1. Create a new function inside functions.php, and use it as a callback function to the action wp_head hook.…

    Read more

  • Create Amazon EC2 Instance

    Create Amazon EC2 Instance

    Amazon EC2 Instance is a virtual computing environment, or simply a virtual server in the Amazon Web Services (AWS) Cloud provided by Amazon Elastic Compute Cloud (Amazon EC2). AWS also provides free tier in your first year that includes 750 hours of t2.micro instance type, and free 30 GiB of EBS storage, to name a…

    Read more

  • Read and Parse JSON files in PHP

    Read and Parse JSON files in PHP

    Read and parse JSON files using the functions file_get_contents() and json_decode() in PHP. The function file_get_contents() will read the entire file into a string, while json_decode() will decode the JSON string. Requirements: PHP PHP JSON extension – added and enabled by default since PHP 5.2.0 How To Read and Parse JSON Files in PHP. The…

    Read more

  • Check Apache, MySql, and PHP versions

    Check Apache, MySql, and PHP versions

    To further check Linux Apache MySQL PHP (LAMP) stack installation, the following can be made to know the exact installed version of each application. Check Apache version. To check the Apache HTTP Server version, type httpd -v on the command line. $ httpd -v Apache’s version is 2.4.55. Check PHP version. To check the PHP…

    Read more

  • Restore MySQL backup from the terminal

    Restore MySQL backup from the terminal

    Efficiently import MySql backup database records from an .sql file using the mysql command from the terminal. A quick and direct approach to restore MySQL backup files from the terminal. For example. mysql -uNAME -p DATABASE < database_backup.sql Enter the PASSWORD when prompted. Enter password: Where. NAME is the user who has access to the…

    Read more