Skip to content

Instantly share code, notes, and snippets.

/**************************************
*// Dynamic Word Wrapping
**************************************/
function wrapWords() {
var element = document.getElementById('element-id'); // grab entry-title element
if (element != null) { // make sure it is on this page
var string = element.innerHTML; // grab its contents
string = string.replace(/<(?:.|\n)*?>/gm, ''); // strip it of any html elements (i.e. a <br> from previous run through)
var array = string.split(" "); // break the string into an array of words
element.innerHTML = ""; // delete the element's contents
$(window).resize(function(){
waitForFinalEvent(function(){
yourFunction();
}, 500, "unique id");
});
/**************************************
*// Wait For It...
**************************************/
var waitForFinalEvent = (function () {
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
function cdtheme {
dir=${PWD##*/}
cd wp-content/themes/$dir
}
function mamptowordpress {
dir=/Applications/MAMP/conf/apache
rm $dir/httpd.conf
ln -s $dir/httpd-wordpress.conf $dir/httpd.conf
stopMAMP
# startMAMP
echo "Happy Wordpress Developing!"
}