Add/overwrite a parameter on an existing post type/taxonomy

you could modify the global variable $wp_post_types or in the case of taxonomies, $wp_taxonomies for example, this will change the menu name and all the labels for the default Posts to Bacon: function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = ‘Bacon’; $submenu[‘edit.php’][5][0] = ‘Bacon’; $submenu[‘edit.php’][10][0] = ‘Add Bacon’; $submenu[‘edit.php’][16][0] = ‘Bacon Tags’; echo ”; … Read more

List custom post types in dropdown

Sorry about that feels a bit weird answering ones own question, but here you go…. Firstly declare the variable: (customcategory) global $userdata; $errors = array(); $title = trim($_POST[‘wpuf_post_title’]); $customcategory = trim($_POST[‘customcategory’]); $content = trim($_POST[‘wpuf_post_content’]); $tags = wpuf_clean_tags($_POST[‘wpuf_post_tags’]); $cat = trim($_POST[‘cat’]); Secondly the array for adding the post: if (!$errors) { $frontend_post = array( ‘post_title’ => … Read more

Using %postname% tag with a Custom Permastruct creates 400 Bad Request Errors from the server

Okay, I feel stupid. I needed to translate %postname%. I thought it did so automatically since the admin page looked like it had but apparently if you do use custom permastructs, you have to translate even the default tags. My solution: add this to my post_type_link filter: $post = get_post($post_id); $permalink = str_replace(‘%postname%’, $post->post_name, $permalink); … Read more

Grab 5 latest posts from custom post type ‘announcements’

The following should work, but isn’t tested: <div id=”header-announcements”> <h3>Announcements</h3> <?php $queryObject = new WP_Query( ‘post_type=announcements&posts_per_page=5’ ); // The Loop! if ($queryObject->have_posts()) { ?> <ul> <?php while ($queryObject->have_posts()) { $queryObject->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/26482/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php } ?> </ul> <div><a href=”#”>View More</a></div> <?php } ?> </div>