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 | |
$user_id = 1; | |
$custom_post_type = 'my_post_type'; | |
function prefix_reset_metabox_positions(){ | |
delete_user_meta( $user_id, 'meta-box-order_post' ); // Posts | |
delete_user_meta( $user_id, 'meta-box-order_page' ); // Pages | |
delete_user_meta( $user_id, 'meta-box-order_' . $custom_post_type ); // Custom post types | |
} | |
add_action( 'admin_init', 'prefix_reset_metabox_positions' ); |
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
# Change post_type value if targeting 'page' or a custom post type | |
# Change ALL posts status from 'publish' to 'draft' | |
UPDATE wp_posts SET post_status = 'publish' WHERE (post_type = 'post' and post_status = 'draft') |
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
const body = document.body; | |
const scrollUp = "scroll-up"; | |
const scrollDown = "scroll-down"; | |
let lastScroll = 0; | |
window.addEventListener("scroll", () => { | |
const currentScroll = window.pageYOffset; | |
if (currentScroll <= 0) { | |
body.classList.remove(scrollUp); | |
return; |
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
// https://usefulangle.com/post/113/javascript-detecting-element-visible-during-scroll | |
var observer = new IntersectionObserver(function(entries) { | |
const body = document.body; | |
const scrollUp = "scroll-up"; | |
const scrollDown = "scroll-down"; | |
// isIntersecting is true when element and viewport are overlapping | |
// isIntersecting is false when element and viewport don't overlap | |
if(entries[0].isIntersecting === true) { | |
body.classList.add(scrollDown); |
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 | |
// In your functions.php | |
class Menu_Icon_Walker extends Walker_Nav_Menu { | |
function start_lvl( &$output, $depth = 0, $args = array() ) { | |
$indent = str_repeat("\t", $depth); | |
$output .= "\n$indent\n"; |
First let's make sure HB is updated. Open up terminal for the following steps.
$ brew update
cd /... into your repository, then...
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
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
Let’s say current URL is: http://example.com/wp-content/plugins/my-plugin/includes/ | |
Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. | |
<?php | |
echo plugin_dir_url( __FILE__ ) . 'images/placeholder.png'; | |
// will output: http://example.com/wp-content/plugins/my-plugin/includes/images/placeholder.png | |
?> |