PuppyFW now available on plugins

Hello everyone. I am pleased to announce that PuppyFW 0.3.0 now is available on plugins repository. PuppyFW is a powerful options framework for WordPress. It was rejected from WPORG plugins repo because they don’t allow a plugin like a framework. But after over 2 months, with options page builder is supported, it has been approved.

PuppyFW’s features:

  • It’s free.
  • Lightweight, fast (use VueJs to render the UI).
  • Support unlimited options pages.
  • Colorpicker, datepicker, image, gallery, map, WordPress TinyMCE field support.
  • Tab field support with unlimited level.
  • Group field support with unlimited level.
  • Every fields can be repeatable.
  • Field dependency (show or hide field base on other field value).
  • Support storing data to separate rows or in a single row in options table.
  • Come with options page builder, easy to create options page without coding skills required.
  • Easy to extend or create new fields.
  • Support API to get option value, include default value.

View this video for more information:

The documentation is on progress. I will add some fields and features before releasing 1.0.0 version. I also looking for a nice UI for this plugin.

Get PuppyFW | View on Github | Documentation

Thank you for reading this post. And any feedback, issue ticket or pull request are very welcome.

Coding Diary, WordPress Tricks

Custom Read more text for each post

WordPress developers and users are quite familiar with the “Read more” text (or “Continue reading”, <!--more--> tag). But I believe that so many people don’t know how to have a custom read more text for each post without modifying the code. Too few article talks about it. My co-workers don’t know it too.

How to do that?

Very simple, instead of <!--more-->, use <!--more View detail--> (“View detail” is the custom text you want). I hope that this is useful for you.

Read more: (search “Having a custom text for each post”)

Coding Diary

Waste time because the max upload file size for multisite

I used multisite sometimes before but never used the network settings. And I wasted an hour because of the lack of knowledge about multisite.

I set both upload_max_filesize and post_max_size to 256M in php.ini files (I did this many times, can be wrong), but when I upload, it always shows Maximum upload file size: 1 MB. I tried to restart the server, add value to .htaccess and wp-config.php file, but it still didn’t work.

But, wait, I had uploaded an over 2MB plugin to this site some days ago without any limit. An idea flashed in my head: “That’s it, multisite.”. And I asked Mr. Google "upload max file size wp multisite" and figured it out. I completely missed the “Max upload file size” setting in Network Admin > Settings > Network Settings.

Hope that no one stupid like me.

Coding Diary

Should not use esc_html() when printing shortcode

Late last night, I received a message from my friend.

Hey, I have a problem which I can’t solve it. I copy contact form 7 shortcode from the backend and show it on frontend, but it shows [contact-form-7 404 "Not found"]

He gave me the credential to access. I made some checkings:

echo do_shortcode( get_theme_mod( 'step_form' ) );
// The result is [contact-form-7 404 "Not found"], this is his problem.

print_r( get_theme_mod( 'step_form' ) );
// The result is [contact-form-7 id="66" title="Contact form 1"], same as the shortcode I used.

echo do_shortcode( '[contact-form-7 id="66" title="Contact form 1"]' );
// I use the shortcode directly and it works.

print_r( '[contact-form-7 id="66" title="Contact form 1"]' == get_theme_mod( 'step_form' ) );
// The result is false. Oh, they are different.

I use print_r() to print two strings in two lines to compare, and this is the result:

Look like no different. But I noticed to the quote characters.

$form_1 = get_theme_mod( 'step_form' );
$form_2 = '[contact-form-7 id="66" title="Contact form 1"]';

print_r( $form_1[19] === $form_2[19] );
// 19 is the index of quote character, and the result is false.

Oh. I think I found the problem. They are two different characters: straight double quote and open double quote (read more here:

My friend declared sanitize_callback for that setting is esc_html. It means that shortcode is passed through esc_html() function before saving, this converts the straight double quote to open or close double quote.

If you use var_dump() instead of print_r() to check and Xdebug is enabled, you can easily see the different, it will save a lot of time for you.

var_dump( get_theme_mod( 'step_form' ) );
// Result: '[contact-form-7 id=&quot;66&quot; title=&quot;Contact form 1&quot;]'


Should not use esc_html() (or some equivalent functions) when printing shortcode. It will convert the straight quote to open or close quote, your shortcode can be broken.

One more advice. You should always escape late the output. But do not abuse it or do it wrong.