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
window.onclick = e => { | |
console.log(e.target); | |
} |
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
#!/bin/bash | |
# tunejack.sh uses the TuneIn public API (at opml.radiotime.com) to search for | |
# a radio station, print out its details and try to play it somehow. | |
if [ "$#" -eq 0 ]; then | |
echo "$0: search for a radio station using the TuneIn API" | |
echo "Usage: $0 PATTERN" | |
exit 1 | |
fi |
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 enable_page_excerpt() { | |
add_post_type_support('page', array('excerpt')); | |
} | |
add_action('init', 'enable_page_excerpt'); |
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 | |
$the_key = ''; // Field Name to sort on | |
$args = array( 'meta_key' => $the_key, | |
'orderby' => 'meta_value', | |
'order' => 'ASC' | |
); | |
global $wp_query; | |
query_posts( | |
array_merge( | |
$wp_query->query, |
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
<Directory /path/to/site> | |
#add the following setting to allow .htaccess in your web dir to work | |
AllowOverride FileInfo | |
</Directory> |
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
RewriteEngine on | |
RewriteCond %{SERVER_NAME} =www.example.com | |
RewriteRule ^ https://example.com%{REQUEST_URI} [END,NE,R=permanent] |
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
define('WP_HOME','http://example.com'); | |
define('WP_SITEURL','http://example.com'); |
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 | |
// Echo with lowercase first letter | |
echo lcfirst( post_type_archive_title( '', false ) ); | |
// Echo as titled in WP | |
echo post_type_archive_title( '', false ); | |
?> |
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 custom taxonomies | |
* | |
* Additional custom taxonomies can be defined here | |
* http://codex.wordpress.org/Function_Reference/register_taxonomy | |
*/ | |
function add_custom_taxonomies() { | |
// Add new "Locations" taxonomy to Posts | |
register_taxonomy('location', 'post', array( | |
// Hierarchical taxonomy (like categories) |
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 setParams() { | |
// Sets the value of any field with a matching name attribute | |
var params; | |
params = getParams(); | |
$.each( params, function( key, value ) { | |
var ref; | |
ref = $('input[name="'+key+'"'); | |
if (ref.length) { | |
$(ref).val(value); | |
} |
NewerOlder