Add Bootstrap to WordPress admin sub-menu page

Add Bootstrap to a plugin page // custom css and js add_action('admin_enqueue_scripts', 'cstm_css_and_js'); function cstm_css_and_js($hook) {     // your-slug => The slug name to refer to this menu used in "add_submenu_page"     // tools_page => refers to Tools top menu, so it's a Tools' sub-menu page     if ( 'tools_page_your-slug' != $hook ) {         return;     }     wp_enqueue_style('boot_css', plugins_url('inc/bootstrap.css',__FILE__ … Continued

Synchronising between Git and SVN

Synchronizing updates between the two repositories. 1. Clone the GitHub Repo SSH $ git clone git@github.com:Praison/seo-wordpress.git HTTPS $ git clone https://github.com/Praison/seo-wordpress.git 2. Change into the Directory $ cd seo-wordpress 3. Set Up a Subversion tracking branch $ git branch --no-track svnsync $ git checkout svnsync $ git svn init -s https://plugins.svn.wordpress.org/seo-wordpress/ --prefix=origin/ $ git svn … Continued

Get all category ids in WordPress [Array]

Choose either one of these options to Get all category ids in WordPress as an Array Get all category ids, Option 1 $output_categories = array(); $categories=get_categories($args); foreach($categories as $category) { $output_categories[] = $category->cat_ID; } Get all category ids, Option 2 $categories_ids = get_terms( array( 'category' ), // Taxonomies array( 'fields' => 'ids' ) // Fields … Continued

Ajax Progress Bar

HTML <style> #progress { width: 500px; border: 1px solid #aaa; height: 15px; } #progress .bar { background-color: #bbd; height: 15px; } </style> <div id="progress"></div> AJAX <script> $.ajax({ url: ajaxurl.php success:function(value){ $("#progress").html('<div class="bar" style="width:' + value.percent + '%"></div>'); } } </script>

$post Object Output in WordPress

WP_Post Object WP_Post Object ( [ID] => [post_author] => [post_date] => [post_date_gmt] => [post_content] => [post_title] => [post_excerpt] => [post_status] => [comment_status] => [ping_status] => [post_password] => [post_name] => [to_ping] => [pinged] => [post_modified] => [post_modified_gmt] => [post_content_filtered] => [post_parent] => [guid] => [menu_order] => [post_type] => [post_mime_type] => [comment_count] => [filter] => )

JSON Vs Array in a Database

JSON Faster to encode JSON Takes Less space Human Readable JSON can be used by many other languages Terms Used : encode, decode Array Faster to unserialise Array Terms Used : Serialise, Unserialise

GitIgnore Directory

.gitignore Directory Example Directory name : uploads Ignoring ALL folders and files # .gitignore uploads Result: # Will Ignore /uploads # directory /uploads # file /example/path/uploads # directory /example/path/uploads # file Ignoring only the Root Directory The correct syntax for that is to put leading and trailing slash: # .gitignore /uploads/ Result: # will ignore … Continued