Articles of custom post types

Get archive post type name

I want to make function, which gets me a post type slug (or object – doesn’t matter) of post type displaying in Archive page, or even on archive pages of its taxonomies. Is it possible? I have this conditional function to recognize a post type (archive / single), but I would like it to return […]

How to use a specific custom field in a custom post type as slug

I’d like use a specific custom field in a custom post type as the slug for the post. My custom post type is members and the custom field that I want to use as the slug is member_user. How can I do this?

Need alternative get_posts function for custom post type

I need to get Related Posts for custom post type. This works only for post. But shows nothing for custom post type as wp_get_post_categories($id) returns nothing. $related = get_posts( array( ‘category__in’ => wp_get_post_categories($id), ‘numberposts’ => $post_num, ‘post__not_in’ => array($id) ) ); I changed the above code. But still get nothing. $category = get_the_terms( $id, ‘cases’ […]

How can I output WPAlchemy repeating fields meta values in my page template?

I have a custom post type, Downloads, which contains some custom metaboxes, including a repeating field. I’m able to output the values for all of them in my page template, but I’m not able to output the repeating fields’ values in my page template. In my downloads_meta.php, I have the following: <div class=”my_meta_control”> <label>Includes:</label> <?php […]

How to get only child terms from a custom taxonomy of current post type?

Having a custom post type ‘pubs’ with custom taxonomy ‘types’ in which admin enter parent terms and their child terms. Using this code to get all the terms of current post type: $object_terms = wp_get_object_terms($post->ID, ‘types’, array(‘fields’ => ‘all’)); if ($object_terms) { echo ” . ” . ” ; $res = ”; foreach ($object_terms as […]

How to get post type information?

So, I’m doing some theme and plugin integration and stumbled upon ome issues with my breadcrumb. Basically my theme has a function that checks for certain post types and then populates the breadcrumb accordingly. Some of my plugins are unknown to the theme, so now I’m manually adding those post types to the breadcrumb method. […]

Displaying a list of Contacts

I would like to list contacts, and I’m unsure how I should do this. Which method should I use “Theme Customization API ” or “custom post type”? My contact page would look like this: <h1>Title <p>paragraph</p> <h1>Title</h1> <p>paragraph</p> <h1>Title</h1> <p>paragraph</p> <h1>Title</h1> <a>email link</a> <h1>Title</h1> <p>paragraph</p> <div> <a><img/></a> <a><img/></a> <a><img/></a> </div> For title paragraph, I will […]

Create a select metabox that the user can pupolate?

I have been working on a plugin that uses text area metaboxes on an options page to populate drop downs in the CPT area. I was with the help of some others able to get the list to show in the select boxes and was able to save the choice to the DB. So far […]

Custom Post Types and Removing Slugs – should we do it?

I’ve run into issues trying to remove my custom post types slugs and I’ve read other questions on here from people with the same problem. We don’t want that slug in our URL! But the solutions to this all seem to involve some sort of hack, a rewrite rule to fix the inevitable 404. Some […]

Template code to split a post and print a custom field?

So I want a blog post but in the center of every blog post I want to split the content and print a custom field attached to the blog post type. Ie you field called “Blog Quote” and the user will enter “Some sample text here.” Then put the body of the post in the […]