January 17, 2017

Wordpress admin - How add custom column in post listing table?


- If you want to add custom column in wordpress admin all post listting, then you just need to add some function on functions.php file.

- Here I try to explain with one example like if you want to add Post ID on admin post listing page.



- Example:

File: wp-content/yourtheme/functions.php

//BELOW FUNCTION FOR DISPLAY HEADER TITLE
add_filter('manage_posts_columns', 'columns_header');

function columns_header('$default') {
 $default['post_id'] = 'Post ID';
 return $default;
}


//BELOW FUNCTION FOR DISPLAY VALUE ON THAT COLUMN

add_action('manage_posts_custom_column', 'columns_content', 10, 2);

function columns_content($column_name, $post_id) {
 if($column_name == 'post_id') {
  echo $post_id;
 }
}

Enjoy!

January 7, 2017

SQL - How to get between value from current timestamp with table timestamp?



- Here I explain with simple example to get between timestamp value from database value

Example:

$starttime = '1479612462'; (timestam value)
$endtime = '1479612462'; (timestam value)

SELECT * FROM <tablename> WHERE date(from_unixtime(<tablefield>)) between '".."' AND '".."'

Enjoy!

SQL - How to check database timestamp value with current timestamp



SQL - Check database timestamp value with current timestamp

- I find a solution for check sql database timestamp value with current timestamp.

Example:

If you want to get past value from current time:

- SELECT * FROM <tablename> WHERE <fieldname> >= UNIX_TIMESTAMP(currentdate())

Enjoy!

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...