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
#!/bin/bash | |
# Check PHP version `php --version` | |
PHP_VER=$(php -v | head -1 | awk '{ print $2 }') | |
# Extensions directory (default: empty string) | |
EXT_DIR="" | |
# Postgres.app < 9.3.5.0 | |
#PG_APP="/Applications/Postgres.app/Contents/MacOS" |
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
/** | |
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :) | |
* source: https://github.com/herewithme/wp-filters-extras | |
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object | |
*/ | |
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) { | |
global $wp_filter; | |
// Take only filters on right hook name and priority | |
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) ) |
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
/* resource: http://www.hypexr.org/linux_scp_help.php */ | |
What is Secure Copy? | |
scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh. | |
Examples | |
Copy the file "foobar.txt" from a remote host to the local host |
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
/* wp-config.php | |
** resource : https://wordpress.org/support/topic/mysqli_real_connect-hy0002002-no-such-file-or-directory?replies=12 | |
*/ | |
/** MySQL hostname */ | |
define('DB_HOST', 'localhost:/tmp/mysql.sock'); |
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
sudo mysqld_safe --skip-grant-tables | |
// open new window and run below commands | |
mysql -u root; | |
UPDATE mysql.user SET authentication_string=PASSWORD('root') WHERE User='root'; | |
FLUSH PRIVILEGES; | |
\q |
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
function delete_posts() { | |
$args = array ( | |
'post_type' => 'lionfish_locations', // post type | |
'nopaging' => true | |
); | |
$q = new WP_Query ($args); | |
while ($q->have_posts()) { | |
$q->the_post(); | |
$id = get_the_ID(); | |
$posted_time = human_time_diff(get_the_time('U'), current_time ('timestamp')); |
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
// cookie authentication | |
function wp_frontend_rest_scripts() { | |
/* ajaxify the post submit */ | |
// wp_enqueue_style('jquerymodal', WPFR_PLUGINURL . 'assets/css/jquery.modal.css'); | |
wp_enqueue_script('my-post-submitter', WPFR_PLUGINURL . 'js/rest-ajax.js', array('jquery') ); | |
//localize data for script | |
wp_localize_script( 'my-post-submitter', 'POST_SUBMITTER', array( | |
'root' => esc_url_raw( rest_url() ), |
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
function sumer_portfolio_shortcode_func($atts) { | |
extract(shortcode_atts(array( | |
), $atts)); | |
$args = array( 'post_type' => 'sumer_portfolio', 'posts_per_page' => -1 ); | |
$l = new WP_Query( $args ); | |
if($l->have_posts()) { |
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
function custom_query_shortcode($atts) { | |
// EXAMPLE USAGE: | |
// [loop the_query="showposts=100&post_type=page&post_parent=453"] | |
// Defaults | |
extract(shortcode_atts(array( | |
"the_query" => '' | |
), $atts)); |