Create XML files on post edit screen

If you’re using XML to send Ajax requests, then WP has something built in: $response = new WP_Ajax_Response(); $response->add( array( // This is the parent elements name ‘what’ => ‘xml_parent_el’ // ‘data’ can only pass CDATA ,’data’ => $foo // ‘supplemental’ can only pass elements with a unique name ,’supplemental’ => $bar ) ); $response->send(); … Read more

Custom Post Type and Taxonomy combination

// Add the new post_type and taxonomy add_action(‘init’, function(){ // Add a post_type named ‘testype’ register_post_type($postype=”testype”, $arguments = array( ‘name’ => $postype, ‘label’ => ‘Test’, ‘public’ => true, ‘exclude_from_search’ => true, ‘capability_type’ => ‘post’, ‘supports’ => array( ‘title’, ‘excerpt’, ‘editor’, ‘custom-fields’, ‘comments’, ), ‘show_in_nav_menus’ => false, ‘hierarchical’ => false, ‘publicly_queryable’ => true, ‘rewrite’ => array( … Read more

List posts AND custom post type by category

I found this answer on the WordPress forum to be of help: http://wordpress.org/support/topic/custom-post-type-posts-not-displayed?replies=5#post-2805344 basically, the poster references a post by Justin Tadlock (who is pretty much an authority in WordPress theme and plugin desing by the way. Follow his blog if you want to get savvy on WordPress.) http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page In his blog post he provides … Read more

Customising rewrite rules for CPT single post URL to work as paged URL

Ok, so I got it working more or less correctly, although there is still a small problem left, please read on.. Here is what I’ve got: in fucntions.php: Rewrite rules add_action(‘init’, ‘my_rewrite_add_rewrites’); function my_rewrite_add_rewrites(){ add_rewrite_rule( ‘^services/([^/]+)/?$’, ‘index.php?post_type=service&order=ASC&orderby=menu_order’, ‘top’ ); add_rewrite_rule( ‘^services/([^/]+)/page/?([0-9]{1,})/?$’, ‘index.php?post_type=service&paged=$matches[2]&order=ASC&orderby=menu_order’, ‘top’ ); } Redirect rule add_action(“template_redirect”, ‘my_template_redirect’); function my_template_redirect(){ global $wp_query; // if … Read more