git remote -v
# View existing remotes
git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL
git remote -v
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 azweb_marketplace_wc_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { | |
global $wpdb; | |
$option_value = get_option( $option ); | |
if ( $option_value > 0 ) { | |
$page_object = get_post( $option_value ); | |
if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) { | |
return $page_object->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
<?php | |
// Inside MyApp/ create composer.json with the below contents | |
{ | |
"require": { | |
}, | |
"autoload": { | |
"psr-4": { | |
"MyApp\\": ["src/", "tests/"] | |
} | |
} |
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
add_action('pre_get_posts', 'um_filter_media_files'); | |
add_filter('wp_count_attachments', 'um_recount_attachments'); | |
function um_recount_attachments($counts_in){ | |
global $wpdb; | |
global $current_user; | |
$and = wp_post_mime_type_where(''); // Default mime type // AND post_author = {$current_user->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
add_action( 'woocommerce_product_after_variable_attributes','variation_settings_fields', 10, 3 ); | |
// Save Variation Settings | |
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 ); | |
/** | |
* Create new fields for variations | |
* | |
*/ | |
function variation_settings_fields( $loop, $variation_data, $variation ) { | |
// Text Field | |
woocommerce_wp_text_input( |
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
# ----------------------------------------------------------------- | |
# .gitignore for WordPress | |
# Bare Minimum Git | |
# http://ironco.de/bare-minimum-git/ | |
# ver 20150227 | |
# | |
# This file is tailored for a WordPress project | |
# using the default directory structure | |
# | |
# This file specifies intentionally untracked files to ignore |
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
# remove specific file from git cache | |
git rm --cached filename | |
# remove all files from git cache | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
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
git reset --soft HEAD^ -> undo last commit and save changes | |
git reset --hard HEAD~1 -> undo last commit and remove changes | |
git reset --hard HEAD~2 -> undo 2 last commits and remove changes | |
git revert commit-hash -> create new commit which reverts last commit | |
git checkout . -> remove all uncommitted changes | |
git checkout filename -> undo changes in specific file | |
git clear -df -> remove all untracked files | |
git rm filename -> remove file from index, after your did git add filename | |
git commit --amend -> change message of last commit |
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 | |
// WordPress stores the site URL in the database by default (which I have never | |
// understood), and it's a pain to have to type out the UPDATE SQL or search in | |
// phpMyAdmin to change it. This is a simple way to put the URL into | |
// wp-config.php instead. | |
// Note that you will still need to update any URLs that appear in the content, | |
// especially when you copy a database from a development site to production: | |
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5 |