wp post list --post_type=post --format=ids | tr ' ' '\n' | xargs -I % wp post meta add % _thumbnail_id {{ATTACHMENT_ID}}
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
<script>console.log({{ product | json }});</script> |
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 | |
$options = getopt('p:'); | |
$prefix = empty($options['p']) | |
? realpath('.') | |
: realpath($options['p']); | |
if (empty($prefix)) { | |
die("Bad prefix. Try again.\n"); | |
} |
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 arrayToTable = function (data, options) { | |
"use strict"; | |
var table = $('<table />'), | |
thead, | |
tfoot, | |
rows = [], | |
row, | |
i, |
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 | |
class OpenCartValetDriver extends ValetDriver | |
{ | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri |
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 | |
/** | |
* Returns the path to a category in the format 1_2_3 | |
* @param int $category_id | |
* @return string the path to the category | |
*/ | |
public function getCategoryPath($category_id){ | |
$path = ''; |
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
/** | |
* Disable author pages | |
*/ | |
add_action( 'template_redirect', function(){ | |
global $wp_query; | |
if ( is_author() && !is_404() ) { | |
$wp_query->set_404(); | |
status_header( 404 ); | |
nocache_headers(); | |
} |
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 echo $this->url->link('product/category', 'path=96'); ?> | |
// http://example.com/category-three/ | |
<?php echo $this->url->link('product/category', 'path=63_78'); ?> | |
// http://example.com/category-one/category-two/ | |
<?php echo $this->url->link('product/category', 'path=63_78_96'); ?> |
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
convert *.jpg -resize 236 -set filename:filename '%t-%wx%h' 'resized/%[filename:filename].jpg' |
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
public function beforeSave(Model $model, array $options = array()){ | |
var_dump($model->data['User']); | |
//array (size=4) | |
// 'id' => string '66' (length=2) | |
// 'first_name' => string 'new first name' (length=14) | |
// 'last_name' => string 'new last name' (length=13) | |
// 'email' => string 'liam@email.com' (length=14) | |
$x = $model->find('first', array('conditions' => array($model->alias . '.' .$model->primaryKey => $model->id), 'contain' => 'User')); |
NewerOlder