PHP Tricks

Few codes to visualise your imagination

  • PHP
  • WordPress
  • Magento
  • JQuery
  • CSS
  • Server Management
  • Contact

Post Category → PHP

Save and show a custom field as Order item meta data – Woocommerce

posted in PHP, WordPress on January 30, 2019 by Ashutosh Pratap 0 Comment
Save and show a custom field as Order item meta data – Woocommerce

In this artcle we will learn how to save and show a custom field as order item meta in woocommerce. Here I suppose to save a COLOR custom field with each of order item in woocommerce.

Fix: Fatal error: Allowed memory size – Increase PHP Memory

posted in PHP, WordPress on April 5, 2017 by Ashutosh Pratap 0 Comment
Fix:  Fatal error: Allowed memory size – Increase PHP Memory

If you are working with WordPress site then you had faced this issue many time. This is common issue of WordPress. Sometimes any piece of code takes enough time to execute and due to this WordPress requires more memory than allocated .

How to change UTC time to your local time using PHP

posted in PHP on March 23, 2017 by Ashutosh Pratap 0 Comment
How to change UTC time to your local time using PHP

How to change UTC time to your local time using PHP is big question in PHP programming language. Today, PHP Tricks provide you a simple and quick function to covert UTC/GMT time to your local time using DateTimeZone PHP class.

Get next seven days list from Today using PHP

posted in PHP on March 19, 2017 by Ashutosh Pratap 0 Comment
Get next seven days list from Today using PHP

A PHP function that helps to get list of next days form current day. There are many way but I created one of best solution using foreach and strtotime in-built PHP functions.

Create random strings in PHP

posted in PHP on March 6, 2017 by Ashutosh Pratap 0 Comment
Create random strings in PHP

I made a PHP function which returns a random string using Alphabets [a to z] and [A to Z], Numbers [0 to 9]. It is very easy to use and can be easily modified.

Get custom posts based on meta field content

posted in PHP, WordPress on March 4, 2017 by Ashutosh Pratap 0 Comment
Get custom posts based on meta field content

To get posts on basis of their meta content, You can use get_posts function as given below:

Easy way to show author details in WordPress

posted in PHP, WordPress on March 1, 2017 by Ashutosh Pratap 0 Comment
Easy way to show author details in WordPress

The image that shows for the author comes from the email address set for that user which goes to a corresponding Gravatar. The display name and bio come from the User settings area in the Admin.

How to add Category Name as class(s) in body tag

posted in PHP, WordPress on March 1, 2017 by Ashutosh Pratap 0 Comment
How to add Category Name as class(s) in  body  tag

The body_class wordpress filter is nice for adding a lots of classes to the body tag that have information about what kind of page is currently being displayed. Probably for styling purposes. But for whatever reason, it doesn’t include a class for the current category (or categories) for a single post. This following code adds all… Continue reading →

PHP Login Script with Remember Me functionality

posted in PHP on February 28, 2017 by Ashutosh Pratap 0 Comment
PHP Login Script with Remember Me functionality

In a login script, remember me feature is used to preserve the login name and password entered by the user. And it can be populated in the login form at the time of login. It minimizes the user effort by preventing to enter login details for each time. Now we are going to see an… Continue reading →