Creating Meta Box In Post / Page

WordPress has metabox in post / page. Meta boxes is used to adding information in your post / page. To create meta box you need to know function add_meta_box, add_meta_boxes , wp_nonce_field, get_post_meta and save_post

Plugin Name: ZZ Metabox
Plugin URI:
Description: Sample Metabox
Version: 1.0.1
Author: WPAmaNuke
Author URI:

 * Register meta box(es).
function zz_register_meta_boxes() {
    add_meta_box( 'zz-meta-box-id', __( 'ZZ Meta Box', 'zz-metabox' ), 'zz_metaboxes_display_callback', 'post' );
add_action( 'add_meta_boxes', 'zz_register_meta_boxes' );
 * Meta box display callback.
 * @param WP_Post $post Current post object.
function zz_metaboxes_display_callback( $post ) {
    // Display code/markup goes here. Don't forget to include nonces!
	// retrieve the custom meta box values
	$zz_price = get_post_meta( $post->ID, '_zz_price', true );
	$zz_plan = get_post_meta( $post->ID, '_zz_plan', true );
	//nonce for security
	wp_nonce_field( plugin_basename( __FILE__ ), 'zz_save_meta_box' );
	// Custom Meta Box Form
	echo '<p>Price: <input type="text" name="zz_price" value="'.esc_attr( $zz_price ).'" size="10" /></p>';
	echo '<p>Plan:
		<select name="zz_plan" id="zz_plan">
			<option value="daily" '. selected( $zz_plan, 'daily', false ). '>Daily</option>
			<option value="weekly" '. selected( $zz_plan, 'weekly', false ). '>Weekly</option>
			<option value="monthly" '	. selected( $zz_plan, 'monthly', false ). '>Monthly	</option>
			<option value="yearly" '	. selected( $zz_plan, 'yearly', false ). '>Yearly </option>
 * Save meta box content.
 * @param int $post_id Post ID
function zz_save_meta_box( $post_id ) {
    // Save logic goes here. Don't forget to include nonce checks!
	// process form data if $_POST is set
		if( isset( $_POST['zz_plan'] ) ) {
		// if auto saving skip saving our meta box data
		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
		//check nonce for security
		check_admin_referer( plugin_basename( __FILE__ ), 'zz_save_meta_box' );
		// save the meta box data as post meta using the post ID as a unique prefix
		update_post_meta( $post_id, '_zz_plan',	sanitize_text_field( $_POST['zz_plan'] ) );
		update_post_meta( $post_id, '_zz_price', sanitize_text_field ( $_POST['zz_price'] ) );
add_action( 'save_post', 'zz_save_meta_box' );

How To Use Escape and require / include in WordPress Theme

After get experiment to upload free theme in here some notes which i think need attention in wordpress theme code. You need to know escape and requre_once replacement. Here is the notes :


Any numeric variable used anywhere

echo int( $int );

Depending on whether it is an integer or a float, (int), absint(), (float) are all correct and acceptable. At times, number_format() or number_format_i18n() might be more appropriate.

Variable within HTML attribute ( esc_attr )

echo '<div id="', esc_attr( $prefix . '-box' . $id ), '">';

Variable URL within HTML attribute

echo '<a href="', esc_url( $url ), '">';

Passing variable to javascript via wp_localize_script()

// No escaping needed in wp_localize_script, WP will escape this.
wp_localize_script( 'your-js-handle', 'variable_name',
		'prefix_nonce' => wp_create_nonce( 'plugin-name' ),
		'ajaxurl'      => admin_url( 'admin-ajax.php' ),
		'errorMsg'     => __( 'An error occurred', 'plugin-name' ),

Variable within javascript block

<script type="text/javascript">
    var myVar = <?php echo esc_js( $my_var ); ?>

Variable within inline javascript

<a href="#" onclick="do_something(<?php echo esc_js( $var ); ?>); return false;">
<a href="#" data-json="<?php echo esc_js ( $var ); ?>">

$var should be escaped with esc_js(), json_encode() or wp_json_encode().

Variable within HTML textarea

echo '<textarea>', esc_textarea( $data ), '</textarea>';

Variable within HTML tags

echo '<div>', wp_kses_post( $phrase ) , '</div>';

This depends on whether $phrase is expected to contain HTML or not.

  • If not, use esc_html() or any of its variants.
  • If HTML is expected, use wp_kses_post(), wp_kses_allowed_html() or wp_kses() with a set of HTML tags you want to allow.

Variable string within XML or XSL context

echo '<loc>', ent2ncr( $var ), '</loc>';


require in theme folder
for example you have something like this :

require get_template_directory() . '/inc/my-functions.php';

you can change it to :


require outsite theme folder

for example you have something like this :

require ABSPATH . WPINC . '/class-wp-editor.php';

you can change it to :

load_template( ABSPATH . WPINC . '/class-wp-editor.php' );

How To Make Your WordPress Website Load Faster

To make your website load faster if you are using wordpress here is some checklists which you need to know

  • Choose good website hosting (website server) and which is suitable for your needs. Why you must choose good hosting ? Because website hosting can determine your website loading. If you want to make website for shopping, it has different need when you want to make website for blogging
  • Choose minimalist theme for fast response. Multipurpose theme ussually has a lot resources which need to be loaded. Because it has many purpose functions , css and javascripts files. Choose theme which is specific for your needs. Anyway you don’t need all the functions.
  • Don’t use too many plugins. I think , the ideal plugins should be less than 6. If you use too many , it will slow your website
  • Compress your javascript , css and images.
  • Always update your theme and plugin so suitable with your WordPress version
  • Use CDN
  • Using caching plugins like w3 total cache
  • Deactivate Trackback and Pingback
  • Delete Old Revision Post. You can use revision control plugin

How To Create Twenty Nineteen Child Theme

Sometimes we need to create wordpress theme child for modification css only. We need to create child theme because regular update on parent theme so we don’t need to change code if there is new update. Here is the way to create child theme for Nineteen Child Theme :

  • Create folder nineteen-child
  • Create file style.css
  • Create file functions.php

That’s very simple. For the structure of sytle.css is like this :

Theme Name: Twenty Nineteen Child
Theme URL:
Description: Twenty Seventeen Child Theme
Author: WPAmaNuke
Author URL:
Template: twentynineteen
Version: 1.0.0
Text Domain: twentynineteen-child
/* Custom CSS goes after this line */

.entry .entry-title a {

For modifying css , you need to use firefox web developer inspector or chrome devtools and do some experiment

To include parent style.css you need to create file functions.php and add code like this :


	add_action( 'wp_enqueue_scripts', 'tnt_enqueue_parent_styles' );

	function tnt_enqueue_parent_styles() {
	   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );


How To Create WordPress Plugin

To Create WordPress Plugin you need to know how basic php , css and html works.
Here is some function which ussually i used for wordpress plugin.


It’s suggested to prefix your function and variable. For example using mfp (My First Plugin). Here is the example $mfp_string , mfp_function.


You can detect directory and url WordPress Plugin using function plugin_dir_path( FILE ) and plugin_dir_url( FILE ).
I ussually use constant some constanta like this :

define( 'MFP_DIR' , plugin_dir_path( __FILE__ ) );
define( 'MFP_URL' , plugin_dir_url( __FILE__ ) );


Hook is function so you don’t need to change the core code. There are 2 hooks : action and filter.


Here are some function which you need to know : do_action , add_action and remove_action


For example your index.php in theme like this

	do_action( 'mfp_header_before' );
	echo '<div>HEADER</div>';
	do_action( 'mfp_header_after' );
	do_action( 'mfp_content_before' );
	echo '<div>CONTENT</div>';
	do_action( 'mfp_content_after' );
	do_action( 'mfp_footer_before' );
	echo '<div>FOOTER</div>';
	do_action( 'mfp_footer_after' );



You can add action in the plugin without change index.php in the theme. For example :

	function mfp_example_header_before1() {
		echo '<div>HEADER BEFORE 1</div>';
	add_action( 'mfp_header_before','mfp_example_header_before1' );
	function mfp_example_header_before2() {
		echo '<div>HEADER BEFORE 2</div>';
	add_action( 'mfp_header_before','mfp_example_header_before2' );
	function mfp_example_footer_before1() {
		echo '<div>FOOTER BEFORE 1</div>';
	add_action( 'mfp_footer_before','mfp_example_footer_before1' );


If you want to remove just use for example remove_action( ‘mfp_header_before’,’mfp_example_header_before2′ ); or if you want to remove all action remove_all_actions( ‘mfp_header_before’ );



Filter is hook for variable. Function which you need to know apply_filters and add_filter.
Example :

	function mfp_do_filter( $mfp_text ) {
		$mfp_text = "VAR DO FILTER";
		return $mfp_text;
	add_filter( 'mfp_var_filter', 'mfp_do_filter' );
	function mfp_apply_filter() {
		$mfp_var = "VAR APPLY FILTER";
		$mfp_var = apply_filters( 'mfp_var_filter' , $mfp_var );
		echo $mfp_var;


If you want to remove filter. Just use for example remove_filter( ‘mfp_var_filter’ , ‘mfp_do_filter’ ); or if you want ro remove all just use function remove_all_filter( ‘mfp_var_filter’ );


After you know some basic functions now it’s time to create your first plugin.

Plugin Name: My First Plugin
Plugin URI:
Description: First plugin which i made
Version: 1.0
Author: WPAmanuke
Author URI:
License: GPLv2

function mfp_filter_the_content_before( $content ) {
    $custom_content = '<div>Before Content Filter</div>';
    $custom_content .= $content;
    return $custom_content;
add_filter( 'the_content', 'mfp_filter_the_content_before' );

function mfp_filter_the_content_after( $content ) {
    $custom_content = '<div>After Content Filter</div>';
    $custom_content = $content . $custom_content;
    return $custom_content;
add_filter( 'the_content', 'mfp_filter_the_content_after' );


Oziz WordPress Theme

Oziz is one page WordPress Theme for landing page. It’s speciality to show resume , skill , portfolio , service , biography info for your reader. It design suitable for job seeker who want to show their resume online. It use bootstrap, fontawesome. You can see the demo in : .

You can make changes in customizer to see the feature. If you want to use Custom Homepage than here is how to do it. Create New Page after that in the right there is Page Attributes choose Template : Custom Homepage

After that in the customizer just make setting in the every section.

Theare 8 sections :

  • About
  • Resume
  • Pricing Table
  • Portfolio
  • Testimonials
  • Team
  • Contact

I start upload in 13 March 2019 and i will see how long before it approved

Magazine News Block Gutenberg Plugin

Gutenberg has become default WordPress Text Editor right now. The princip is making each as component/block just like page builder which has been exist before. Because it’s new , i just want to experiment for learning purpose creating simple magazine news block builder plugin for gutenberg. It work using ajax for backend. For development i’m using create-guten-block from ahmadawais and learning from other existence gutenberg block. For developing gutenberg blogk , i must install nodejs and learning reactjs library. If you don’t know about React just learn in youtube , there are many good tutorials there.

Choose Magazine News Block
Magazine News Block Setting

Covfefe WordPress Theme

Covfefe WordPress Theme is my next experiment WP Theme with 3 column design.

It use FontAwesome and Bootstrap Framework 4 ( Grid and Utility) which i include in the style.css , So the css is only 1 file.  It use microformat for the php file so search engine friendly. Just using hentry , entry-title , entry-summary and entry-content. Just download the covfefe wordpress theme. You can see the demo

It still my experiment in coding WordPress Theme standard.  My next WordPress Theme experiment will be niche about Landing Page and Resume. Don’t hesitate to give input in the comments.

Headline WordPress Theme

Headline WordPress Theme is my next experiment WP Theme with simple design. I just want to know how many request people who want to download minimalist theme. So i make theme with no jQuery included only simple Javascript , simple CSS , no web font. It’s based Underscore WP Framework which i only modify a little in the css and php code. You can download free headline wordpress theme on If you want to customize color and font and remove footer copyright just buy headline pro extensions plugin

It use Bootstrap Framework ( Grid and Utility) which i include in the style.css , So the css is only 1 file.  It use microformat for the php file so search engine friendly. Just using hentry , entry-title , entry-summary and entry-content. I hope it’s usefull. And if you have any ideas or request just comment on this post .

Showcase Theme Preview Reloaded

For some days i am looking for showcase theme preview plugin in for showing my future themes Finally i found WordPress Theme Showcase Plugin in , but it was 8 years old and not updated. So i just modify it a little to meet my needs. The plugin is simple and just like my expectation so i add javascript to make it work in post , page and category.

Beside using shortcode  [theme_showcase] , you can use Theme Preview widget on sidebar / footer to choose theme preview which you want

I upload it to so it’s usefull for anybody and can be modified as they need. This plugin is usefull for wordpress theme developer showcase their simple themes.

You can see the demo here :