Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* Ensure that the post_tag taxonomy uses our own special counting logic.
*
* Normally, this would simply be specified by register_taxonomy() with
* the update_count_callback flag. Since we use the core tag taxonomy,
* let's just continue to hijack it.
*/
add_action( 'init', function() {
$GLOBALS['wp_taxonomies']['post_tag']->update_count_callback = 'jquery_update_plugin_tag_count';
@nacin
nacin / issues.css
Created October 16, 2015 06:02
User style for GitHub issues to show the issue owner's name, rather than a 4-pixel avatar. Inspired by @mdickers47.
.issues-listing .table-list-issues .issue-title {
width: 700px;
}
.issues-listing .table-list-issues .table-list-cell-avatar {
width: auto;
}
.issues-listing .table-list-issues .table-list-cell-avatar img {
content: "";
}
.issues-listing .table-list-issues .table-list-cell-avatar img::before{
Updated to WordPress 3.5 and can't find Twenty Twelve?
On Appearance > Themes, if you see "twentytwelve - Stylesheet is missing" under "Broken Themes", then you have this problem. (Multisite: You can find broken themes on Network Admin > Themes.)
This only affects individuals who updated to WordPress 3.5 in the first hour of its release, and who didn't already have Twenty Twelve installed.
The current fix is to connect to your server via FTP, and remove the empty wp-content/themes/twentytwelve directory. Then, go to Appearance > Themes > Install Themes and search for and install Twenty Twelve. (Or find it on the Featured tab.)
@nacin
nacin / Modific.sublime-settings.js
Created September 25, 2012 06:52
My config for Modific. Disables --internal-diff (didn't work on Mac OSX 10.8 with svn 1.6.18 client). Reprograms a few key bindings I'll actually use.
// Modific default settings
{
// Name of a region icon
// Valid icon names are dot, circle, bookmark and cross
"region_icon": "circle",
// You can use your commands instead of plain "git" or "svn"
// e.g. "/usr/bin/git" or "C:\bin\git.exe"
"vcs": [
["svn", "/usr/bin/svn"],
Index: wp-content/themes/twentytwelve/style.css
===================================================================
--- wp-content/themes/twentytwelve/style.css (revision 21639)
+++ wp-content/themes/twentytwelve/style.css (working copy)
@@ -437,10 +437,13 @@
body {
font-size: 14px;
font-size: 1rem;
- font-family: "Open Sans", Helvetica, Arial, sans-serif;
+ font-family: Helvetica, Arial, sans-serif;
@nacin
nacin / func.sh
Created July 10, 2012 16:44
Nacin's WP Test Wrapper
function wptest() {
TESTROOT=/Users/nacin/Sites/tests
ARGS="--colors $@"
FORCE=0
DEBUG=0
REPLACE=$(echo $ARGS | sed -e 's/ -f\>//')
if [ "$ARGS" != "$REPLACE" ]; then
FORCE=1
ARGS=$REPLACE
$ php -r 'echo ini_get("include_path") . "\n";'
.:/usr/local/pear/share/pear
$ which php
/opt/local/bin/php
$ /opt/local/bin/php -r 'echo ini_get("include_path") . "\n";'
.:
@nacin
nacin / jquery-html-category-descriptions.php
Created June 19, 2012 13:33
HTML Category Descriptions
<?php
add_action( 'init', 'jquery_unfiltered_html_for_term_descriptions' );
add_action( 'set_current_user', 'jquery_unfiltered_html_for_term_descriptions' );
function jquery_unfiltered_html_for_term_descriptions() {
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'pre_term_description', 'wp_filter_post_kses' );
if ( ! current_user_can( 'unfiltered_html' ) )
add_filter( 'pre_term_description', 'wp_filter_post_kses' );
}
<?php
add_action( 'init', function() {
register_post_type( 'plugin', array(
'name' => 'Plugin',
'public' => true,
'rewrite' => false,
) );
} );
<?php
function jquery_posts_only_for_searches( $query ) {
if ( $query->is_main_query() && $query->is_search() )
$query->set( 'post_type', 'post' );
}
add_action( 'pre_get_posts', 'jquery_posts_only_for_searches' );