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
set :stage, :production | |
role :app, %w{[email protected]} | |
set :deploy_to, '/usr/share/nginx/capistrano/' | |
set :linked_files, %w{local-config.php content/object-cache.php content/debug.log robots.txt} | |
set :branch, "master" |
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
set :application, 'capistrano' | |
set :repo_url, '[email protected]:capistrano/wordpress.git' | |
set :scm, :git | |
set :ssh_options, { :forward_agent => true, } | |
set :deploy_via, :remote_cache | |
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"] | |
set :linked_dirs, %w{content/uploads content/cache} |
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_action( 'pre_get_posts', function( $query ) { | |
if ( ! $query->is_main_query() ) { | |
return; | |
} | |
// Du måste också se till att det är rätt query på något sätt, | |
// annars kommer alla queries påverkas av detta. | |
// Kanske is_tax( 'product_cat' ) ?? |
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_action( 'admin_menu' , function() { | |
foreach ( get_post_types() as $post_type ) { | |
remove_meta_box( 'postcustom' , $post_type , 'normal' ); | |
} | |
}); |
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 ( '' != $query->query_vars['search'] ) { | |
$meta_term = str_replace( '*', '', $query->query_vars['search'] ); | |
$query->query_fields = 'DISTINCT SQL_CALC_FOUND_ROWS wp_users.ID'; | |
$query->query_from = "FROM $wpdb->users LEFT JOIN $wpdb->usermeta ON $wpdb->usermeta.user_id = $wpdb->users.ID"; | |
$query->query_where .= " OR display_name LIKE '%$meta_term%' OR ($wpdb->usermeta.meta_key = 'first_name' AND $wpdb->usermeta.meta_value = '{$meta_term}') OR ($wpdb->usermeta.meta_key = 'last_name' AND $wpdb->usermeta.meta_value = '{$meta_term}')"; | |
} |
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
RewriteCond %{HTTP_HOST} ([_0-9a-zA-Z-.]+)\.(dev|local)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule (.*) http://example.com/$1 [R=302,L] |
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 Olab_Meta_Box { | |
public $id, $title, $meta_box; | |
/** An array of elements to be rendered in the meta box */ | |
public $elements = array(); | |
/** An array of repeatable elements to be rendered in the 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
var nodes = [ 1, 2, 3, 4, 5 ], | |
length = nodes.length, | |
i = 0; | |
for ( ; i < length; i++ ) { | |
( function ( node ) { | |
// oooohhhh! | |
})( nodes[i] ); | |
} |