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 categories_to_classes() | |
{ | |
$out = ''; | |
$cats = get_the_category(); | |
foreach ( $cats as $cat_object ) | |
{ | |
$out .= $cat_object->slug . ' '; | |
} |
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 | |
/* | |
Description: Adds a taxonomy filter in the admin list page for a custom post type. | |
Written for: http://wordpress.stackexchange.com/posts/582/ | |
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins | |
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps... | |
*/ | |
add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list'); | |
function add_businesses_column_to_listing_list( $posts_columns ) { | |
if (!isset($posts_columns['author'])) { |
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 | |
/* | |
Plugin Name: Category Custom Fields | |
Author: scribu | |
*/ | |
class Category_Custom_Fields { | |
function init() { |
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 | |
$docs = get_posts('numberposts=-1&post_type=page&post_parent=36&orderby=title&order=ASC'); | |
$faculty = array(); | |
foreach ($docs as $doc) { | |
array_push($faculty, $doc->ID); | |
} | |
$currentElement = array_search($post->ID, $faculty); | |
$next = isset( $faculty[$currentElement+1] ) ? $faculty[$currentElement+1] : null; | |
$prev = isset($faculty[$currentElement-1]) ? $faculty[$currentElement-1] : null; | |
if ( !is_null($prev) ) { |
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 | |
/* | |
Adds Post Counts by Post Type per User in the User List withing WordPress' Admin console (URL path => /wp-admin/users.php) | |
Written for: http://wordpress.stackexchange.com/questions/3233/showing-users-post-counts-by-custom-post-type-in-the-admins-user-list | |
By: Mike Schinkel (http://mikeschinkel.com) | |
Date: 24 October 2010 | |
*/ |
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 | |
/* | |
posts-by-category-with-price.php | |
Query for a list of WordPress posts by category, | |
but only those with a postmeta->meta_key='Price' that's >0 and NOT NULL. | |
Author: Mike Schinkel (http://mikeschinkel.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 | |
/* | |
PostsByTaxonomy class that extends WP_Query and filters to includes all posts that have any term of a taxonomy. | |
Author: Mike Schinkel (http://mikeschinkel.com) | |
This example works, just drop into the root of your website and call directly. | |
Use the class in your plugins or themes. | |
See: |
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 | |
/* | |
PostsOrderedByMetaQuery class that extends WP_Query and sorts posts meta_key | |
Author: Mike Schinkel (http://mikeschinkel.com) | |
This example works, just drop into the root of your website and call directly. | |
Use the class in your plugins or themes. | |
See: http://stackoverflow.com/questions/4111255/how-to-sort-a-query-posts-function-by-custom-field-while-limiting-posts-by-ano |
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 | |
/* Register WordPress theme settings ******************************************/ | |
/* Navigation menus -----------------*/ | |
register_nav_menus( array( | |
'primary' => 'Principal' | |
)); | |
/* Images ---------------------------*/ | |
add_theme_support( 'post-thumbnails' ); | |
/* Sidebars -------------------------*/ |
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 | |
/** | |
* To be used on a WordPress Widget object | |
* Fields named as '_foo_bar' will become $new_instance['foo']['bar'] = $val | |
* Fields named as '_lorem_ipsum_dolor' become $new_instance['lorem']['ipsum']['dolor'] = $val | |
**/ | |
function update( $new_instance, $old_instance ) { | |
foreach ( $new_instance as $key => $val ) { |