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

<?php
/*
Plugin Name: ZZ Metabox
Plugin URI: http://www.wpamanuke.com
Description: Sample Metabox
Version: 1.0.1
Author: WPAmaNuke
Author URI: https://wpamanuke.com
*/

/**
 * 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>
		</select>
	</p>';
}
 
/**
 * 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 )
			return;
		
		//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' );

Showcase Theme Preview Reloaded

For some days i am looking for showcase theme preview plugin in wordpress.org for showing my future themes Finally i found WordPress Theme Showcase Plugin in wordpress.org , 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 wordpress.org 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 : http://reviews.wpamanuke.com/theme-preview/

 

Flat CMS

Flat CMS is CMS which doesn’t use database. So the file is saved as text file. Here is some Flat CMS based on PHP which i have found which support MarkDown Format :

  • Grav : It is modern flat file CMS which is good , I just explore this a little . I’m still searching how to do pagination. And the file is big about >4 MB without admin and 15 MB for admin (in zip file) . So it’s not suitable for my web hosting
  • PicoCMS : another flat CMS. It’s good but not found yet about pagination yet for many text files
  • HTMLy : I think it’s the most suitable for my website. It support pagination and easy to make theme. It has twentyeleven wordpress theme too. Only one problem about handling $date_format not initialize. So i just add $date_format = “%d %M %Y”; if there is error in the code.

So if you want to use Flat CMS in PHP. My suggestion is using HTMLy

Sony Camera

I have ever used sony camera and nikon camera. Based on my experience nikon camera is the best.
Here is the sony camera specification.
The performance of a DSLR, in about half the size and weight. The NEX-5N is the interchangeable lens camera that fits in your pocket. Enjoy Full HD 1080/60p or 24p movies, astounding low-light pictures, continuous shooting up to 10 fps, incredible panorama shots, and 3.0-inch tiltable Live View touch screen LCD.
This is the world’s smallest interchangeable lens digital still camera using a large APS-C size sensor (as of Aug 2011). The removal of the conventional mirror box and viewfinder results in a camera body that is about half the size and weight of a standard DSLR camera.
Up to 10 fps shooting
Capture the decisive moment in sports and get the ideal baby photo. Up to 10 fps continuous shooting at full 16.1 MP resolution. Standard continuous shooting speeds vary based upon shooting conditions and memory card speeds.