EDIT – Solved missed my darn rows every 3 projects Pleas first see the Static Version here. Now the issue…
re-register custom post type with custom capabilities
I have created custom post type as below. register_post_type( ‘connector’, array( ‘labels’ => array( ‘name’ => __( ‘Connectors’ ), ‘singular_name’…
How to display custom taxonomy parent and child including the posts
I’m currently working on a WordPress-project which has to display all the categories, subcategories and posts within these subcategories of…
Custom Post Type Child Pages
I’m getting a 404 page when viewing child-pages of a custom post type. Right now I have a pages (let’s…
Change the properties of a custom post type after it’s been registered?
The specific use case is that I have a CPT added through a plugin, and I’d like it to be…
WordPress monthly archive links result in 404
When I use the archive widget in a sidebar, it creates the normal monthly post archive listing like the following:…
Custom post type numeric pagination
I have already develop wordpress custom type.But I cant add numeric pagination.I need it very urgent. Here is my script.…
Ignores post_type when no results
I have a custom searchbox that only searches a particular custom post type. On the results page I have modified…
Change custom post type slug from plugin options
I’d like to give users the option to change a custom post type slug in my plugin. Using this answer,…
Custom Post Type and Breadcrumbs Conflict
I have a custom post type. It seems the breadcrumbs have an extra space for a parent page (which does not exist) inserted. You can see this in the image I attached.
What is happening with theis custom post type that is causing this extra, non-existent parent?
Here is my custom page type:
add_action( ‘init’, ‘register_cpt_result’ );
function register_cpt_result() {
$labels = array(
‘name’ => _x( ‘Case Results’, ‘result’ ),
‘singular_name’ => _x( ‘Result’, ‘result’ ),
‘add_new’ => _x( ‘Add New’, ‘result’ ),
‘add_new_item’ => _x( ‘Add New Result’, ‘result’ ),
‘edit_item’ => _x( ‘Edit Result’, ‘result’ ),
‘new_item’ => _x( ‘New Result’, ‘result’ ),
‘view_item’ => _x( ‘View Result’, ‘result’ ),
‘search_items’ => _x( ‘Search Case Results’, ‘result’ ),
‘not_found’ => _x( ‘No case results found’, ‘result’ ),
‘not_found_in_trash’ => _x( ‘No case results found in Trash’, ‘result’ ),
‘parent_item_colon’ => _x( ‘Parent Result:’, ‘result’ ),
‘menu_name’ => _x( ‘Case Results’, ‘result’ ),
);
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘description’ => ‘My firm’s case results’,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’ ),
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘show_in_nav_menus’ => true,
‘publicly_queryable’ => true,
‘exclude_from_search’ => true,
‘has_archive’ => true,
‘query_var’ => true,
‘can_export’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’
);
register_post_type( ‘result’, $args );
}
Here is my breadcrumbs function:
function crumbs() {
if ((is_page() && ! is_category()) || is_archive() || is_single() || is_single()) {
$crumbs = ”;
$crumbs .= ”;
$crumbs .= ‘Home’;
$post_ancestors = get_post_ancestors($post);
if ($post_ancestors) {
$post_ancestors = array_reverse($post_ancestors);
foreach ($post_ancestors as $crumb)
$crumbs .= ”.get_the_title($crumb).”;
}
if (is_category() || is_single()) {
$category = get_the_category();
$crumbs .= ”.$category[0]->cat_name.”;
}
if (!is_category())
$crumbs .= ”.get_the_title().”;
$crumbs .= ”;
$close_crumb = ”;
$open_crumb = ”;
$separator = ‘→’;
echo str_replace($close_crumb.$open_crumb, $close_crumb.$separator.$open_crumb, $crumbs);
}
}
Reslug a Custom Post Type
I built a plugin for wordpress with custom post types and somewhere along the line I realized that I had to rebuild the way slugs are generated. Originally, I had the cpt making default slugs like new-post-1, new-post-2, etc. I realized this was silly and rewrote the naming convention to create a slug from the post title like it should be. The only issue I have now is that I want to have all the old posts I entered into wordpress use the new naming convention. Is there a function or a way to tell wordpress to rebuild/regenerate the slugs for a particular custom post type.
I found this plugin: http://wordpress.org/plugins/re-slug/
But.. it does not work for cpts
Thanks for the help.
Is it possible to load a different sidebar in single.php based on a meta_query filter?
I have a custom post type ‘speakers’ and I have a checkbox custom field (meta_query) to separate my Conference speakers from my Workshop speakers.
I can filter my speakers with this meta_query and things are working fine. But how do I use a different sidebar based on the Conference or Workshop speaker meta_query?
When I click the speakers for their detail (no matter Conference or Workshop speaker) the detail page loads my single-speakers.php and the code to get the sidebar in my single-speakers.php is:
How can I specify a different sidebar, for example get_sidebar(‘workshop’)? Can I write a conditional code to load a different sidebar based on the speakers meta_query? Does this make sense?
Thanks