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 | |
/** | |
* This is a version of | |
* http://www.viper007bond.com/2011/09/20/code-snippet-add-a-link-to-latest-post-to-wordpress-nav-menu/ | |
* that supports multiple placeholders. In this case, the placeholder fetches | |
* the latest post from a particular category. | |
*/ | |
// Front end only, don't hack on the settings page |
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 | |
# Spotify | |
wp_embed_register_handler( 'spotify', '#https?://open\.spotify\.com/.*#', 'spotify_embed_handler' ); | |
add_shortcode( 'spotify', 'spotify_shortcode' ); | |
if ( get_option('embed_autourls') ) | |
add_filter( 'the_content', 'spotify_embed_ids', 7 ); |
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 | |
$this = 'file1'; | |
do_stuff(); | |
?> |
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 | |
$query_args = array( | |
'foo' => 'bar', | |
'apple' => 'orange', | |
'posts_per_page' => 50, | |
'offset' => 0, | |
); |
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 | |
// floatvalue() ended up working best most of the time, with only a few exceptions | |
error_reporting(E_ERROR | E_WARNING | E_PARSE); | |
$floatvals = array( | |
'1,337.01', | |
'1,337', | |
'1337.01', |
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 | |
/** | |
* All of this code is in a big class that implements things like meta boxes and | |
* tons of other stuff but for now here's the relevant functions. | |
* | |
* Note the custom post types and custom taxonomies are just in placeholder form. | |
* I haven't gone through and properly set the labels, etc. for them like I will | |
* when I release the plugin. | |
*/ |
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 | |
add_action( 'pre_get_posts', 'localtv_posts_and_pages_for_search' ); | |
function localtv_posts_and_pages_for_search( $query ) { | |
if ( $query->is_main_query() && $query->is_search() ) | |
$query->set( 'post_type', array( 'post', 'page' ) ); | |
} |
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 | |
/** | |
* Takes posts that are in category A and also adds them to category B | |
*/ | |
// Uncomment this to proceed | |
exit( "You need to edit the file and enter the hostname and category IDs.\n" ); | |
// What blog? Asking for both for safety reasons. |
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 | |
# Stick this file in your wp-content folder | |
define( 'WP_INSTALLING', true ); | |
require_once( dirname( __FILE__ ) . '/../wp-load.php' ); | |
timer_start(); | |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
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 Settings - User | |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"font_face": "Consolas", // Windows, you'll likely want default or something else | |
"font_size": 10, | |
//"spell_check": true, |