This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parts = window.location.search.substr(1).split("&"); | |
var $_GET = {}; | |
for (var i = 0; i < parts.length; i++) { | |
var temp = parts[i].split("="); | |
$_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$meta_boxes[] = array( | |
'id' => 'select_post', | |
'title' => 'Post Selector', | |
'pages' => array( 'post', 'page' ), | |
'context' => 'normal', | |
'priority' => 'high', | |
'fields' => array( | |
array( | |
'name' => 'Post', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'array_unflatten' ) ) | |
{ | |
/** | |
* Convert flatten collection (with dot notation) to multiple dimmensionals array | |
* @param Collection $collection Collection to be flatten | |
* @return Array | |
*/ | |
function array_unflatten( $collection ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'array_swap' ) ) | |
{ | |
/** | |
* This function works like array_flip but allows users use values as array | |
* For example, | |
* [ foo => ['bar', 'baz'] ] | |
* will becomes | |
* [ | |
* 'bar' => 'foo', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert a regular string to snake_case | |
* For example, Hello World => hello_world | |
* | |
* @param String $str String to be converted | |
* @return String String in snake_case | |
**/ | |
function str_snake( $str ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Put an array. Then make the key same as value. Or key will become slug of value of slug is set to true | |
* | |
* @param Array $array Array to convert | |
* @param boolean $slug Slug the key or not | |
* @return Array output | |
*/ | |
function array_symmetry( $array, $slug = false ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) | |
{ | |
$meta_boxes[] = array( | |
'id' => 'brand_product', | |
'title' => 'Brands and Products', | |
'post_types' => array( 'post', 'page' ), | |
'context' => 'normal', | |
'priority' => 'high', | |
// Conditional Logic can be applied to Meta Box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'wp-load.php'; | |
set_time_limit(0); | |
session_start(); | |
if ( ! isset( $_SESSION['import_3'] ) ) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install LAMP Server | |
#-------------------------- | |
sudo apt-get update | |
sudo apt-get install tasksel | |
sudo tasksel install lamp-server | |
#Install PHPMyAdmin | |
#---------------------------- | |
sudo apt-get install phpmyadmin | |
# Open file below and add the following line to the end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
trait CanUseMeta | |
{ | |
public function getMetaTable() | |
{ | |
return $this->table . '_meta'; | |
} |
OlderNewer