Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [custom-post-types]

Custom Post Types extend the WordPress back-end to support additional, non-Post content.

0
votes
1answer
14 views

How do I find a way to create a global single.php for a custom post type?

I am working on making a custom post type plugin for my website. However, I want to make it universal for any theme I may decide to change. Or to be able to append the post type to a single post file ...
0
votes
0answers
20 views

Conditionally rewrite a custom post type's registered taxonomy url

I have a custom post type in WordPress that has its own custom taxonomy. The taxonomy currently has URLs that look like so /taxonomy-slug/taxonomy/. This is great, except I want a single one of these ...
1
vote
0answers
27 views

Removing custom post type slug from URL

I want to remove custom post type slug from URL and for this I have used this solution Removing slug from custom post type URL It is working fine but I also want to add category with custom post type ...
1
vote
1answer
26 views

How to make a custom taxonomy selectable in post publish area?

I registered a new taxonomy: function all_about() { register_taxonomy( 'all_about', array('post'), /* if you change the name of register_post_type( 'custom_type', then you have to change ...
0
votes
0answers
10 views

Template for Custom Post type with Custom Taxonomy for a particular Term

I am creating a custom post type with its own custom taxonomy. I then want to create two different templates. Post with a particular Term in the custom post type show one template and the remaining ...
0
votes
0answers
9 views

Query the same posts twice with “rand”

I building a WorPress site that is going to run ads. The ads will display before and after a visitor interacts with certain parts of the site. Each ad is a post from a custom post type. The ...
5
votes
1answer
602 views

Enable Gutenberg on custom post type

I have this custom post type: function create_posttype() { register_post_type( 'companies', array( 'labels' => array( 'name' => __( 'شرکتهای عضو' ), 'singular_name' =...
0
votes
0answers
18 views

Is that possible to showing repeater field value to JWplayer each value

I have created the custom repeater fields wanna showing each sub_field value to Jwplayer, but only echo last episode ..when i click (choose) episode 1 or watching other episode, only display last ...
0
votes
1answer
26 views

How to add independent “Tags” to Custom Post Type?

I'd like to create a custom taxonomy called "Tags", just like the native one that can be found on Posts, with the same name/slug but independent from it: 'taxonomies' => array('post_tag') I know ...
0
votes
0answers
11 views

Filter past events in post list

I have been looking for a few days, but am struggling to find the function I need. I am creating an events post type for a theme, with the event start and finish timestamps saved in respective meta ...
0
votes
1answer
34 views

Parent child relation between Post and Page

I have a recipes website called Green Comfort Food. I'm new to building websites so I am figuring it out with not a lot of background knowledge. I have a homepage, recipes page, pages to devide those ...
1
vote
1answer
26 views

Custom post type, organized by categories

I know there are lots of questions and answers out there for this very thing, but I'm having a hard time putting it all together. The goal is to get a <ul> with category names as the <li>, ...
0
votes
0answers
23 views

Get meta values from parent post and save in child post

I have a custom post type "E-Books" with two categories "E-Book Title" and "Chapter Page", and custom meta boxes (table of contents, etc). The E-Book post type uses one page template, and displays ...
0
votes
0answers
26 views

Emergency Problem

Language : Turkish I am not English I am writing to you using google to translate. I have a website with my school that uses WordPress. ClassiPress is my theme. I have a boat written in python ...
0
votes
0answers
18 views

How to Remove/Edit CPT template Content with Custom Meta Box

I try to Remove CPT template(single-proucts.php) Content with Custom Meta Box. I created a Input select option for change content in my CPT metabox it's working then update post I need to change ...
0
votes
0answers
15 views

Instructor can view, edit, delete only theirs courses

In LearnDash there are courses, lessons, topics and quizzes. I want each instructor to view, edit, delete only their own courses. I managed to do so in the course and topic level but I don’t know how ...
0
votes
1answer
42 views

Can I change the page of a Custom Post Type slug?

So I've created a simple custom post type for separating content in the back-end. The Custom Post Type has a slug and generates a URL using this slug, such as www.yoursite.com/slug/. Any pages made in ...
0
votes
1answer
22 views

Cache the registration of a custom post type?

In computation, cache is used to store the state of something that is complex to generate. We then use the cached version for future requests. Taking a look inside the register_post_type function, I ...
0
votes
0answers
30 views

Display post with specific role

I have a custom post type called quiz and custom category for quiz called quiz-type. I also have two roles: candidate and recruiter. I had created two categories in quiz type which are also candidate ...
0
votes
1answer
22 views

Get a list of all custom post type names/slugs [duplicate]

I'm trying to create a dropdown-list of all my custom post types. It would look like this: <select> <option value="post">Post</option> <option value="book">Book</...
0
votes
2answers
112 views

Creating a custom post type using a object oriented approach?

I am looking for a good approach regarding the creation of custom post types in WordPress, using object orientation. How can I create CPTs in an clean, organized way? Take into consideration these 3 ...
1
vote
1answer
24 views

How to set the seo title tag on a page by page basis?

I am storing the SEO title with advanced-custom-fields. How do i set the seo title tag within my single-mypost.php template. This is the place where i can call get_field('title_tag'); I tried ...
0
votes
0answers
14 views

Getting 404 on child page with pre_get_posts() on custom posts

I want to have custom taxonomy for publishing different type of posts. I have registered several custom posts like with the code below function wtp_case_studies() { $labels = array( '...
0
votes
0answers
24 views

How to use multiple orderby conditions on query search results? (orderby one post type, relevance)

I have a need to sort the search results so that a custom post type "authors" is always at the top, followed by all other post types sorted by relevance. I've found numerous examples about altering ...
0
votes
0answers
43 views

Post meta is not accessible within save_post hook

I am using this code to update post meta but it is not working. function run_when_job_published( $post_id, $post, $update){ $post_meta = get_post_meta($post_id); } add_action('save_post_jobs', '...
0
votes
1answer
34 views

Removing WP custom post type slug causes 404 error with blog posts when blog does not have front slug

I've tried this wonderful solution (solution below, original post here) for removing the slug from a custom post type, but unfortunately it causes a 404 error for blog posts when the blog slug is ...
0
votes
0answers
13 views

next_post_link() and previous_post_link() in single-cpt.php file not working

I am trying to display links to previous post and next post in for a custom post type regardless of whatever custom taxonomies they are attached to. I have a custom post type called experiencecont ...
0
votes
0answers
16 views

How to Get Parent Category from attchment post with Plugin: Custom Content Shortcode

Im using "Plugin: Custom Content Shortcode " on my site . Just stuck with my code here. Im using short code on custom post with pods on my site. im going to display images from posts if image title ...
0
votes
1answer
33 views

how to alter args of a custom post type

I have a plugin that creates a custom post type. However it doesn't create an archive or make the single posts visible and I would like to change that. This is the code to register the post type: ...
0
votes
0answers
35 views

Front-end submitted post is published with admin ID as author

I have a form for registered users to submit a post from the front-end of my site. The post is registered in a custom post type, all works. But now that I have to add a button for the user to delete ...
0
votes
0answers
15 views

Get images if post title contain mention keyword and image title contain other mention keyword

I want to show images on my custom page but with condition. I mean if my post contain "Keyword 1" and image contain "Keyword 2" I want to show that images. Now I have many posts that's title contain "...
0
votes
0answers
10 views

How to update a custom post's field value based on matching another field's value with two different custom post types

I have a custom post type named "customers" that contains numerous custom fields, two of which are "customerid" and "company_name". I have a second custom post type named "estimates", which contains ...
0
votes
0answers
19 views

How to deny edit capability for pending custom post type?

So I have a custom post type called sale, a role called sales_manager and a custom capability called edit_pending_sales. I want to allow the Sales Manager to add new sales, which is be set to pending ...
0
votes
1answer
20 views

Subpages for Custom Post Type. Does that even exist?

I am running multiple contests (one of which in a really large scale, all-year long) on my e-shop. They all have different rules, different structure so I've created a custom post type 'contest' for ...
1
vote
1answer
17 views

Creating select dropdown with parent-level custom post types

I'm trying to create a dropdown with an option for each top-level parent. I've gotten the query down because when I print the results, I see the posts I'm looking for. My code is also creating the ...
2
votes
0answers
29 views

List custom post type by custom tax term as page title

I have a page called "Developments" and I want to list all the Project posts by the custom tax Project Type using the page title as the term. This doesn't work: <?php $title_slug = ...
0
votes
1answer
20 views

Show posts from custom post type sorted by category/taxonomy on a one-pager/page

I'm working on a one-pager wp site for a festival (page: Home). This festival has 4 stages. I created a custom post type "artists" with custom taxonomy "stages" and entered the 4 names of the stages. ...
1
vote
2answers
18 views

How to get all `supports` attributes by post type?

i.e. when post is registered, like this: $args= [ 'supports' => ['thumbnail', 'title', 'post-formats' ...] ] If later, I want to get all supports attribute for specific post type, which ...
0
votes
1answer
14 views

Add input radio menu to post

Is there any function to add radio buttons to post and how can I call it? (exampe on img). Thank you for suggestion
0
votes
1answer
39 views

Calculate Repeater Meta Box Input Field Values and Display Total

I have a repeater custom meta box for my custom post type. I am new to Javascript and can not figure out how to calculate the value for each repeated input field and display the total combined. I have ...
0
votes
0answers
26 views

Dynamic Dropdown Select Filter with Custom Taxonomy in Custom Posts

I want to create a Dynamic Dropdown Select Filter in my homepage to filter custom posts by parent and sub-categories. The maximum depth for filtering is 4 levels. My Custom taxonomies structure is ...
0
votes
1answer
15 views

Using Wordpress custom post type to display StoryMapJS

So I want to use StoryMapJs on my website, and I want to be able to manage these via a custom post type. I've created a custom post type and fields for each option, but I'm struggling to get them to ...
0
votes
1answer
78 views

Validate custom fields before save using WordPress Rest API

I want to add custom validation to post(custom post type) before it save into the WordPress. I am using the Rest API to insert the post to custom post type. What I need is the fields which I created ...
0
votes
2answers
92 views

How to use wp_mail in CPT page

I have a CPT and inside the CPT I have a contact form. The contact form directly sends to WordPress dashboard, Now I'm trying to implement when a user submits the contact form they will receive a "...
0
votes
1answer
18 views

Custom post types - meta_query: search lesson which starts sooner

I have lesson custom post types which have 4 date sub fields (among others): period_a_start, period_b_start, period_c_start, period_d_start. I want to create a query to get the 8 first lessons that ...
0
votes
1answer
32 views

Pretty Permalinks with CTP and Taxonomies / Hierarchical

My Site has 2 Custom Post Types with a 2 Taxonomies. One taxonomy is “Location” which is 2 level / hierarchical (Country, City). My goal is to get our Post Types & Taxonomies in a SEO Pretty ...
1
vote
0answers
103 views

How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?

I want to use Categories and Tags everywhere in WP (Articles, Pages, Attachments and CPT like for example Jetpack-Portfolio) I have been able to show these 2 core taxonomies (category and post_tag) ...
1
vote
0answers
40 views

How to add button to post page WordPress 5.x

How can I add a button to a posts page? what hook can be used to add a custom button I'd like to place it next to, or near, the "Publish/update" button, or modify the publish button for triggering ...
0
votes
2answers
76 views

Query a custom taxonomy in a function to create an csv file

I a problem with getting the query for custom taxonomy to work in this function. The $filter is filled with data but the get_posts() does not use it? The query works without the tax_query and there ...
0
votes
0answers
18 views

Generate post content from meta fields

I have a custom post type (match). Each posts on this CPT has one ore more custom fields. Is it possible to automatic generate the 'post content' with the value of my custom fields on these posts? ...