Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂
Happy and peace when coding

Tran Ngoc Tuan Anh rilwis

🙂
Happy and peace when coding
View GitHub Profile
@rilwis
rilwis / add-data.php
Created Mar 5, 2015
Support to migrating data to a group
View add-data.php
<?php
$data = array(
array(
'year' => 2013,
'title' => 'Test',
'wins' => 1,
'podiums' => 2,
'poles' => 3,
'description' => 'test description',
),
@rilwis
rilwis / register-meta-box.php
Created Mar 6, 2015
Group with better-include demo
View register-meta-box.php
<?php
global $meta_boxes;
$meta_boxes = array();
$meta_boxes[] = array(
'title' => 'Pedigree',
'only_on' => array(
'id' => array( 1 ), // Show only on "Hello World" post
),
'fields' => array(
@rilwis
rilwis / fix-thumbnail.php
Last active Oct 6, 2015
Fix missing thumbnail for Auto Post Thumbnail plugin
View fix-thumbnail.php
<?php
/**
* Usage: upload to WP folder
* Run it!
*/
echo 'Working... ';
require_once( 'wp-load.php' );
@rilwis
rilwis / FitWP.xml
Last active Nov 29, 2015 — forked from Rarst/deprecated.md
WordPress coding standards configuration for PhpStorm (goes into .WebIde10/config/codestyles)
View FitWP.xml
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="FitWP">
<option name="USE_SAME_INDENTS" value="true" />
<option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true" />
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
@rilwis
rilwis / admin-body-class.php
Created Feb 12, 2013
Style Add New / Edit Post page in WordPress using admin body class. @see http://www.deluxeblogtips.com/?p=1281
View admin-body-class.php
<?php
/*
Plugin Name: Admin Body Class Demo
Plugin URI: http://www.deluxeblogtips.com/?p=1281
Description: Style Add New / Edit Post page in WordPress using admin body class
Version: 0.1
Author: Rilwis
Author URI: http://www.deluxeblogtips.com
License: GPL2+
*/
View acf-gravity-forms-v5.php
<?php
class acf_field_gravity_forms extends acf_field {
function __construct() {
$this->name = 'gravity_forms_field';
$this->label = __( 'Gravity Forms', 'acf' );
$this->category = __( "Relational", 'acf');
$this->defaults = array(
'multiple' => 0,
@rilwis
rilwis / register.php
Created May 11, 2016
Live update custom_html field
View register.php
<?php
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes )
{
$meta_boxes[] = array(
'title' => 'Update custom html field demo',
'fields' => [
[
'name' => 'Group',
'type' => 'group',
'id' => 'group',
@rilwis
rilwis / nested1.php
Created May 17, 2016
Nested group demo
View nested1.php
<?php
add_filter( 'rwmb_meta_boxes', 'nested_groups_demo' );
function nested_groups_demo( $meta_boxes )
{
// Meta Box
$meta_boxes[] = array(
'title' => __( 'Books', 'rwmb' ),
'fields' => array(
@rilwis
rilwis / include-extension.php
Created Jun 6, 2016
Include Meta Box extension in themes/plugins
View include-extension.php
<?php
require_once get_template_directory() . '/class-tgm-plugin-activation.php'; // Path to TGM Plugin Activation class.
add_action( 'tgmpa_register', 'your_prefix_register_required_plugins' );
function your_prefix_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
@rilwis
rilwis / custom.php
Created Jul 23, 2016
MB Admin Columns - Add Custom Non-Meta Column
View custom.php
<?php
class Prefix_Custom_Admin_Columns extends MB_Admin_Columns_Post {
public function columns( $columns ) {
$columns = parent::columns( $columns );
/**
* Add more column in a specific position
*
* @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace'
* @param string $target The target column. Used with combination with $position
You can’t perform that action at this time.