Custom post type permalink: only use %post_id% and remove %postname%

I found the answer myself – so here is the update to above problem: Custom post type registration: function create_post_type_mycustomname() { $args = array( ‘capability_type’ => ‘post’, ‘has_archive’ => ‘mycustomname’, ‘rewrite’ => array( ‘slug’ => ‘/mycustomname’, ‘feeds’ => false ) ); register_post_type(‘ctp_mycustomname’, $args); } add_action(‘init’, ‘create_post_type_mycustomname’); Change the links: function mycustomname_links($post_link, $post = 0) { … Read more

Get Post ID by Content

WordPress has a handy function called post_exists() which allows you to find an existing post by its title, content, and/or date. It returns the post ID on success or 0 otherwise. In your case, you can use $post_id = post_exists( ”, ‘{“member_id”:33}’ ) to find the post you’re looking for. Note: That function doesn’t check … Read more

Custom Post Types on Category Pages

For custom post types with custom taxonomy you can make a template for that taxonomy. Your custom taxonomy template would be named taxonomy-{taxonomy}.php. For example, if your taxonomy was called “cooking-categories” you would name your file taxonomy-cooking-categories.php. More information on template files for special taxonomy archives can be found in the codex here: http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display

Combining Multiple Taxonomies in one URL

This rewrite rule should work (assuming “brand” and “type” are the taxonomy registered names): function custom_rewrite_rules() { add_rewrite_rule(‘^brand/(.*)/type/(.*)?’, ‘index.php?brand=$matches[1]&type=$matches[2]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_rules’); Remember to flush the rewirte rules after saving this code in your site. Then you will need to hook in several places to fix things. For example, you may need to hook … Read more

How to call a custom post with get_posts() instead of query_posts()?

Hi Elium2009: Using your code, I think this is what you were looking for? (note that WP_Query() is just the more direct version of get_posts()): <?php $posts = WP_Query(array( ‘taxonomy’ => ‘type-mario’ ‘term’ => ‘games’, ‘posts_per_page’ => 10 )); ?> <p>Mario games</p> <?php while ( $posts->have_posts() ) : $posts->the_post(); ?> <div id=”post-<?php the_ID(); ?>” <?php … Read more

tag.php doesn’t work with tags on a custom post type post?

If this is related to your other question, what you’ve got is a custom taxonomy, so you need either a taxonomy-{taxonomy}.php template (in your case taxonomy-article_topics.php), or just a more general taxonomy.php template. (also, go back and accept answers to your other questions here if they’ve been solved!) UPDATE sorry, misunderstood your question- add this … Read more