How to display posttypes and taxonomy in standard posts, not in a separate label?

when you register a taxonomy, the second argument is the post type it is available for: register_taxonomy( $taxonomy, $object_type, $args ); if you want the taxonomy to work for a custom type as well as standard posts, you can pass an array of types: $object_type = array( ‘your_custom_type’, ‘post’ ); alternately, you can use register_taxonomy_for_object_type: … Read more

Get post-meta value of all custom-posts – lowest to highest year-count?

something like this should do the job: global $post; $years = array(); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); $this_year = get_post_meta( $post->ID, ‘event_date’, true ); if ( $this_year = date( ‘Y’, $this_year ) ) { if ( ! in_array( $this_year, $years ) ) { $years[] = $this_year; } } … Read more

Loop and add Specific Categories and Products Images

In your functions.php function show_all_thumbs() { global $post; $post = get_post($post); $images =& get_children( ‘post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent=”.$post->post_parent); if($images) { foreach( $images as $imageID => $imagePost ){ unset($the_b_img); $the_b_img = wp_get_attachment_image($imageID, “thumbnail’, false); $thumblist .= ‘<a href=”‘.get_attachment_link($imageID).'”>’.$the_b_img.'</a>’; } } return $thumblist; } In your page template file: $loop = new WP_Query( array( ‘post_type’ => ‘demo’, // or whatever … Read more

Better in the long run to use post date or custom taxonomy to sort/separate posts by year?

I can’t see any practical reason to use a custom taxonomy here. You can already query posts by year using OOB query and archive stuff (see this Codex article about the “year” WP_Query parameter, and this one about the “yearly” mode for wp_get_archives()). If you’re asking purely about performance, I’d consider this kind of thing … Read more

Custom rewrite rules for /pastissues/%category%-%postname%.html

Or, you can do that – after headhache and spent one day to find a solution : You have to set ‘rewrite’ => false in your register_post_type(); and add after closing register_post_type() : // 404 CPT permalink WP bug… global $wp_rewrite; $projet_structure=”/projets/%projet%”; $wp_rewrite->add_rewrite_tag(“%projet%”, ‘([^/]+)’, “projet=”); $wp_rewrite->add_permastruct(‘projet’, $projet_structure, false); Where projet is my CPT See here … Read more

Is there a hook between clicking on “Add new” and the edit screen of a new post?

This plugin does the same thing as what you are looking for: http://wordpress.org/extend/plugins/magic-action-box It has a custom post type called action-box but has different types of action boxes that you can select when you create a new action box. The code you want is found inside the plugin’s directory lib/classes/ProsulumMabAdmin.php. Look for the method add_actions() … Read more