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://stackoverflow.com/questions/9899372/pure-javascript-equivalent-of-jquerys-ready-how-to-call-a-function-when-t/9899701#9899701 | |
function docReady(fn) { | |
// see if DOM is already available | |
if (document.readyState === "complete" || document.readyState === "interactive") { | |
// call on next available tick | |
setTimeout(fn, 1); | |
} else { | |
document.addEventListener("DOMContentLoaded", fn); | |
} |
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
<script> | |
window.addEventListener('DOMContentLoaded', function() { | |
(function($) { | |
console.log('Hello world.'); | |
})(jQuery); | |
}); | |
</script> |
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 search-replace "OLDDOMAIN" "NEWDOMAIN" --precise --skip-columns=guid,user_email --all-tables --skip-plugins --skip-themes --report-changed-only |
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 | |
// Dequeue the Boostrap Block Styles | |
// The one stylesheet should be compiled with a preprocessor | |
function dequeue_dequeue_plugin_style(){ | |
wp_dequeue_style( 'wp-bootstrap-blocks-styles' ); //Name of Style ID. | |
} | |
add_action( 'wp_enqueue_scripts', 'dequeue_dequeue_plugin_style', 999 ); |
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 | |
// Uses a str_replace to get rid of the p tags for a ACF WYSIWYG field. | |
// This preserves other styling in the WYSIWYG field compared to other methods. | |
$text = get_field('the_field'); | |
$stripped_text = str_replace(array('<p>','</p>'),'',$text); | |
echo $stripped_text; |
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 | |
function custom_blog_permalinks() { | |
global $wp_rewrite; | |
$wp_rewrite->set_permalink_structure( $wp_rewrite->root . '/blog/%postname%/' ); // custom post permalinks | |
} | |
add_action( 'init', 'custom_blog_permalinks' ); |
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 /* | |
Search just a custom post type using WordPress' native search. | |
Uses Boostrap classes. | |
Swap out "CustomPostTypeHere" for your custom post type slug. | |
*/ ?> | |
<form class="form-inline" action="<?php echo home_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
<?php // Sample code for the Relational > Link ACF field ?> | |
<?php $link = get_field('link'); | |
$link_url = $link['url']; | |
$link_title = $link['title']; | |
$link_target = $link['target'] ? $link['target'] : '_self'; ?> | |
<p> | |
<a href="<?php echo esc_url($link_url); ?>" target="<?php echo esc_attr($link_target); ?>" class="text-info"> | |
<?php echo esc_html($link_title); ?> <i class="fa fa-caret-right"></i></a></p> |
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 | |
/** | |
* Enqueue CSS & scripts file | |
* The "Cache Buster" appends the theme version number as a ?ver= | |
* The "Cache Buster" auto increments whenever the theme's version number increments | |
* This gets visitors to load the new CSS/JS whenever the theme updates | |
*/ | |
function bp_enqueue() { | |
// Increments the version number for css/js based on the theme's version number |
NewerOlder