Articles of custom post types

Meta box data is saved but NOT displayed in the meta box text field. Why?

I have a custom post type and I created it using the following code. /* DRAMAS */ register_post_type(‘dramas’, array( ‘label’ => ‘Dramas’, ‘show_ui’ => true, ‘supports’ => array(‘title’, ‘thumbnail’, ‘custom-fields’, ‘description’), ‘labels’ => array ( ‘name’ => ‘Dramas’, ‘singular_name’ => ‘Drama’, ‘menu_name’ => ‘Dramas’ ), ) ); Following code for the meta box mark up […]

Custom Post Type with Configurable Sidebar via ACF

I am using a custom post type (CPT) trainings on one of my client’s sites. I’ve also added a CPT called sidebars, which can get linked into trainings or pages via the “relation” field type. To get an overview over all trainings, I’ve created a separate template “tpl-trainings.php” and added an “overview”-page, which in turn […]

Revert to previous dropdown options after change

I have two dropdowns (which are using Chosen.js). The second dropdown displays custom categories: <script type=”text/javascript”> jQuery(document).ready(function($) { $(‘select[name=”post_type”]’).change(function (event) { if ($(‘select[name=”post_type”]’).val() === ‘test’) { $(‘select[name=”second_dropwdown”]’).html(“<option>Sorry, no options</option>”); $(‘#second_dropwdown’).prop(‘disabled’, true).trigger(‘chosen:updated’); }else{ $(‘#second_dropwdown’).prop(‘disabled’, false).trigger(‘chosen:updated’); } }); }); </script> If I choose “test” in the first dropdown, the second dropdown becomes disabled and shows “Sorry, no […]

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 […]