Skip to content

Instantly share code, notes, and snippets.

View rilwis's full-sized avatar
🙂
Happy and peace when coding

Anh Tran rilwis

🙂
Happy and peace when coding
View GitHub Profile
@rilwis
rilwis / FitWP.xml
Last active November 29, 2015 04:42 — forked from Rarst/deprecated.md
WordPress coding standards configuration for PhpStorm (goes into .WebIde10/config/codestyles)
<?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 / fix-thumbnail.php
Last active October 6, 2015 13:28
Fix missing thumbnail for Auto Post Thumbnail plugin
<?php
/**
* Usage: upload to WP folder
* Run it!
*/
echo 'Working... ';
require_once( 'wp-load.php' );
@rilwis
rilwis / admin-body-class.php
Created February 12, 2013 16:25
Style Add New / Edit Post page in WordPress using admin body class. @see http://www.deluxeblogtips.com/?p=1281
<?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+
*/
@rilwis
rilwis / add-data.php
Created March 5, 2015 10:39
Support to migrating data to a group
<?php
$data = array(
array(
'year' => 2013,
'title' => 'Test',
'wins' => 1,
'podiums' => 2,
'poles' => 3,
'description' => 'test description',
),
@rilwis
rilwis / register-meta-box.php
Created March 6, 2015 04:36
Group with better-include demo
<?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(
<?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 02:47
Live update custom_html field
<?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 01:34
Nested group demo
<?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 / remove-resources.php
Created June 1, 2016 05:52
Remove scripts and styles for metabox.io
<?php
// Remove styles of plugin
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
add_filter( 'bbp_default_styles', '__return_empty_array' );
// Remove bbPress scripts on non-bbPress pages
add_filter( 'bbp_default_scripts', function ( $scripts )
{
return is_bbpress() ? $scripts : [ ];
} );
@rilwis
rilwis / include-extension.php
Created June 6, 2016 02:08
Include Meta Box extension in themes/plugins
<?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(