WordPress Snippets
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
# Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
# Backup old data | |
Rename-Item -Path "./data" -NewName "./data_old" | |
# Create new data directory | |
Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
Remove-Item "./data/test" -Recurse | |
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
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 | |
/** | |
* Example code for tutorial post on custom meta boxes: | |
* https://wptheming.com/2010/08/custom-metabox-for-post-type/ | |
*/ | |
/** | |
* Registers the event post type. | |
*/ | |
function wpt_event_post_type() { |
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 | |
//sanitize adsense box adsense codes | |
function weart_sanitize_adsense( $input ) { | |
esc_js($input); | |
$input = str_replace(array("\r", "\n"), '', $input); | |
return $input; | |
} | |
//sanitize checkbox |
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
File path for a pre WordPress 4.7 asset: | |
<img src="<?php echo get_template_directory_uri(); ?>/images/filename.png" /> | |
File path for a WordPress 4.7 + asset: | |
<img src="<?php echo get_theme_file_uri( ‘/images/filename.png’ ); ?>" /> |
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
if(!function_exists('get_theme_file_uri')){ | |
function get_theme_file_uri( $file = '' ) { | |
$file = ltrim( $file, '/' ); | |
if ( empty( $file ) ) { | |
$url = get_stylesheet_directory_uri(); | |
} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { | |
$url = get_stylesheet_directory_uri() . '/' . $file; | |
} else { | |
$url = get_template_directory_uri() . '/' . $file; | |
} |
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
# npm using https for git | |
git config --global url."https://github.com/".insteadOf git@github.com: | |
git config --global url."https://".insteadOf git:// | |
# npm using git for https | |
git config --global url."git@github.com:".insteadOf https://github.com/ | |
git config --global url."git://".insteadOf https:// |
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
.price_slider{ | |
margin-bottom: 1em; | |
} | |
.price_slider_amount { | |
text-align: right; | |
line-height: 2.4em; | |
font-size: 0.8751em; | |
} |
NewerOlder