Dewey Bushaw
Forum Replies Created
-
Forum: Alpha/Beta/RC
In reply to: Show Categories Filter on Custom Post Type ListHere is all the code you need to get this custom post type filter to work:
add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' ); function my_restrict_manage_posts() { global $typenow; $taxonomy = $typenow.'_type'; if( $typenow != "page" && $typenow != "post" ){ $filters = array($taxonomy); foreach ($filters as $tax_slug) { $tax_obj = get_taxonomy($tax_slug); $tax_name = $tax_obj->labels->name; $terms = get_terms($tax_slug); echo "<select name='$tax_slug' id='$tax_slug' class='postform'>"; echo "<option value=''>Show All $tax_name</option>"; foreach ($terms as $term) { echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>'; } echo "</select>"; } } }
This line: $taxonomy = $typenow.’_type’; has ‘_type’ at the end of it because my custom taxonomy looks like this:
register_taxonomy(‘event_type’,’event’,create_taxonomy_args(‘event’,true));
So what ever you add on as a suffix (if you do that) you need to change in the code above.
Forum: Plugins
In reply to: get_posts only posts that have thumbnail (has_post_thumbnail)@marcus1060 you are the man!!!
Forum: Alpha/Beta/RC
In reply to: Show Categories Filter on Custom Post Type ListI have found somatic’s method the best solution as it is compatible with the coming version of 3.1.
Forum: Alpha/Beta/RC
In reply to: Custom Taxonomy Filter not working in Admin edit.php 3.1(b2)@ryansigg – Check out this post by somatic on a better/different way to do this that is wp3.1 RC compatible.
Forum: Fixing WordPress
In reply to: Dynamically loaded content via AJAX breaks loading jQuery objects.You need to use the .live() code for your JS for content loaded in via AJAX.
Where you would do this with out ajax:
$(‘a’).click(function(){ do stuff… })
You would do:
$(‘a’).live(‘click’,function(){ do stuff… });
This allows you to control the new links added in via AJAX.
Forum: Themes and Templates
In reply to: Retrieving featured image URLFixed code. It was missing a ‘)’ in the IF and $image is an array so made the call to $image[0] for the src url.
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')"> </div> <?php endif; ?>
Forum: Alpha/Beta/RC
In reply to: Show Categories Filter on Custom Post Type ListIs there any reason why this would work for some custom post types and not others. I have a total of four custom post types and this works perfect for Events and Success Stories.
Issues:
- On Staff Members it throws a “no … found” page for one term “Head Coach”.
- On WODs I consistently get the “no … found” page.
For the Head Coach one I thought maybe since it is made up of two words but the url that is created uses the term ID.
functions.php – https://pastie.org/private/nymddfgstu8r7eoaslgaq
post-columns.php (filter code located here) – https://pastie.org/private/yxbtiu3anfmzgexcd5vgsa
taxonomies.php – https://pastie.org/private/ama35mgctl9ycepfyae5bq
post-types.php – https://pastie.org/private/zqziceoctvduldopxlirjqThanks