mosdave
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Sort (custom) posts by last word in titleThat’s just what I needed. Nice!
Forum: Fixing WordPress
In reply to: Custom Columns in custom post type edit pageOk I found the solution. It seems that manage_posts_custom_column gets called while rendering *all* post type objects including posts, pages, and custom post types.
Therefore to fix the repeating problem simply check for the post type before getting the terms.
case "artist": if ($post->post_type == 'gallery') { $terms = wp_get_post_terms($post->ID, 'artist'); echo $terms[0]->name; } break;
Thanks to shibashake.com for the info, in particular this post:
https://shibashake.com/wordpress-theme/add-custom-post-type-columnsCheers
Forum: Fixing WordPress
In reply to: WordPress for several micrositesJust a follow up to my question.
I ended using custom post types and custom permalinks to organise the site structure.
A helpful blog post on using a taxonomy in your permalink structure can be found here
Cheers
PS Thanks for the reply esmi
Forum: Fixing WordPress
In reply to: Display caption with the_post_thumbnailYou need to include the ‘post_parent’ as an argument so it only looks at the current post.
Here’s the full function I’m using: (a combo of AGWD101 and danielwiener code)
function the_post_thumbnail_caption() { global $post; $thumb_id = get_post_thumbnail_id($post->id); $args = array( 'post_type' => 'attachment', 'post_status' => null, 'post_parent' => $post->ID, 'include' => $thumb_id ); $thumbnail_image = get_posts($args); if ($thumbnail_image && isset($thumbnail_image[0])) { //show thumbnail title echo $thumbnail_image[0]->post_title; //Uncomment to show the thumbnail caption //echo $thumbnail_image[0]->post_excerpt; //Uncomment to show the thumbnail description //echo $thumbnail_image[0]->post_content; //Uncomment to show the thumbnail alt field //$alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); //if(count($alt)) echo $alt; } }