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
29 views

Taxonomie cpt with acf

I have a CPT 'formations'. In the page of one of my formations (single.php) there is a section "other articles". I would like from my editor of each "formation" page, select categories to show other "...
0
votes
0answers
25 views

How to display custom post type pagination buttons when processing AJAX request

Good morning everyone, I am trying to filter posts using ajax by custom fields and custom taxonomy values from a custom post type. Ajax request works fine, It retrieves all needed data to display, but ...
0
votes
1answer
33 views

Assigning alternate single-{cpt} template based on blog_id in multisite

I have a multisite network with some shared custom post types, and I'm trying to create a function that loads a custom single-{cpt} template for a given post type by $blog_id when defined, and ...
0
votes
1answer
30 views

post_type incorrect for custom post type

I am trying to display a different template depending on the post type. I have registered two custom post types called resource and contact. When I try to get the post type in search.php (using ...
1
vote
1answer
26 views

how to add extra GET parameters to post to url with add_rewrite_rule?

I have a blog that has a custom post type article, and the link is http://example.com/article/lorem-ipsum. How can I use add_rewrite_rule to add a new link style to the same post http://example.com/...
0
votes
0answers
31 views

Loop (for search results) returning right posts, but wrong post type

Hoping this isn't already asked/answered, but it's a tough one to search. I've got a site based on the Flatsome theme which uses custom post types (through various plugins). The search page works in ...
3
votes
1answer
26 views

How to show more posts on an archive page?

I'd like to show more posts on my custom archive page, but can't seem to figure out the right way to do it. Currently it displays 10, which is the number set in WP Settings and the number I'd like on ...
0
votes
1answer
32 views

How to configure the output of breadcrumbled CPT UI

Tell me how to set the full path in bread crumbs in CPT UI. I have - Post type and taxonomy The code prints in breadcrumbs - / Taxonomy / Name, how to do what would print Post type / Taxonomy / Name?...
0
votes
0answers
20 views

Custom Post Type Front Page Gives 404

I have developed a plugin on one site and just now moved it to another. At start I had that problem in the initial site too. Saving permalinks again solved it in the initial website. I then moved it ...
0
votes
0answers
13 views

Connect Custom Post type to Woocommerce

I have a custom post type called Vendors with several custom fields like logo, name, address e.t.c. How is it possible to connect a product of woocommerce with the Vendors cpt and bring some of the ...
0
votes
1answer
31 views

Unable to show meta box data in frontend

I am able to show the featured image and the text in the editor but I made some additional custom post types and meta box to show some important data but I am unable to show(highlighted in red in this ...
1
vote
1answer
20 views

Pull Two Different Post Types into Different HTML Containers on the Same Page

If I have two different post types - say, the standard WP post type and a custom post type, how do I go about pulling them both into one page, but into two different HTML containers? For instance I'd ...
1
vote
0answers
14 views

Meta Query Not Returning Output Despite Having Matching Values

I am formulating a query to pull from a custom post type, with values matching a custom field. The results are blank although I have 3 values set matching the custom field. Is my query formulated ...
0
votes
1answer
18 views

Live search by custom tag

Live search: $the_query = new WP_Query( array( 's' => esc_attr( $_POST['keyword'] ), 'post_type' => 'custom_type', 'sentence' => 'true' )); if( $the_query->have_posts() ) : while( $...
0
votes
0answers
28 views

Prev / Next Post Same taxonomy Custom Post Type

I have a custom post type "cases" and a custom taxonomy "before-after-gallery". On my single-case.php my prev and next post links are jumping from one category to another. <?php next_post_link(...
3
votes
3answers
73 views

Filter admin columns by custom post field value

I have a custom post type called dogs. Within the Add Dog interface, I have a radio-button group that gives choices for color, which are added to the new dog post as meta data. There are about five ...
0
votes
1answer
16 views

Getting a GET error in console - 404 not found for wp-json

I am trying to use ajax for a Load more posts button on a Custom Post Type In my functions file I have this: add_action('rest_api_init', 'custom_api_get_news'); function custom_api_get_news(){ ...
0
votes
0answers
19 views

Sort custom post type by other custom post type field. (Places by their reviews mean vote)

I'm trying to sort Places (first custom post) by its Reviews (second custom post) average (mean) vote. So, basically I have two custom post types, one is Places and the other one is Reviews. Reviews ...
0
votes
1answer
28 views

Retrieve custom post types by custom taxonomies with WP_Query

I am trying to filter custom post type data using ajax. For that, I display some custom taxonomies as select tags. I've been trying for 6 hours to retrieve custom post types using WP_Query with these ...
0
votes
0answers
22 views

Set a Default CPT taxonomy by taxonomy id

How can I set a default CPT taxonomy by taxonomy id? I don't want to do it by slug. Must be by ID.
1
vote
0answers
22 views

Options page - dropdown of users

I want to create an options page in WPAdmin that will let me select among registered post type "Members" and anoint them as "captains". Here is my code so far but the dropdown is not functioning ...
0
votes
0answers
38 views

how to display new private message to users?

We have created a user panel for our users in our site. Now we want to make a new part in the toolbar of the user panel to send private messages to every user we need. For that, we created a post type ...
1
vote
1answer
17 views

Custom template Page 2 not working

When I click Next page, page-2 showing 404 error page. Page one is OKAY. I have created this custom post type with CPT UI plugin and building the theme from scratch. <?php /** * Template name:...
0
votes
1answer
31 views

providing access to post_id or post inside functions.php

I'm trying to add metaboxes to the bottom of any post which is created from a specific post template. ie I don't want metaboxes on all my posts, just certain posts. At the point when I decided to ...
0
votes
2answers
22 views

Skip latest 3 posts from loop

I downloaded a starter theme (Underscores). I want to exclude first 3 post from my loop on index page. Here is the loop; <?php if ( have_posts() ) : if ( is_home() && ! is_front_page()...
0
votes
1answer
20 views

Using taxonomy term in CPT permalink – Pages 404's

Having some issues with creating the permalink structure that I'd like. Found a piece of code on Stack Exchange, which unfortunately I cannot locate right now. I have a CPT called project and I want ...
2
votes
2answers
57 views

Use a textarea for a custom post type

I have a custom plugin, using a custom post type for data entry capabilities in the admin section. I would like to use a textarea form, along with the checkboxes, select and text input fields I am ...
0
votes
1answer
17 views

Password protection template and automatic fall in post type

I have a custom template that I protect with a password. This template shows a listing of posts from a custom post type. The password on this custom template works, but the single posts are not ...
0
votes
1answer
22 views

Custom taxonomy terms registered not showing when added in child theme

I have registered a new custom post type and taxonoy in my child theme using following code: add_action('init', 'tours_register'); function tours_register() { $slug = 'tour'; $labels = array( ...
2
votes
1answer
30 views

Disabling post_type in URL

I noticed that by default, WordPress lists all posts if you use mysite.com/?post_type=post at the end of the URL. What's the simplest way of deactivating this? I would prefer it redirected to my 404 ...
0
votes
1answer
15 views

How can i add multiple variable to a !== query

i'm trying to add a taxonomy filter on multiple CPT linked to this taxonomy. i'm good for 1 cpt at a time, but i'm definitly sure i can do much easyier with one function for all cpt. actually i have ...
0
votes
1answer
42 views

Getting data from dynamically allocated metaboxes within a custom post

I need to dynamically allocated metaboxes for a data entry type feature. Each Metabox represents a set of data associated with member such as name, address, city etc. Not sure what I am doing ...
0
votes
1answer
35 views

get_the_post_thumbnail_url('full') returns empty from custom post type

I'm trying to display the full size image of the single post from a custom post type that I created, below is what I've tried <?php $args = array( 'post_type' => 'press', 'order' ...
0
votes
2answers
25 views

Dynamically add a unique number/identifier at the end of post titles

I am currently developing a small recruitment style website, and have encountered an issue. I have created a form (Using Gravity Forms) that allows users to create a custom post (Current Vacancies) ...
0
votes
1answer
16 views

Move custom post menu to under plugin admin menu

I have a custom plugin with a set of menus. I also have working a custom post type, but I am not sure how to push the custom post under the plugin's admin menu item. The code for the custom post, ...
0
votes
1answer
21 views

Cannot choose custom categories for custom post type in post editor

I am trying to make a custom post type for short texts, notici. I want to register a custom taxonomy for Notice categories. I have tried the code below in my plugin. The tags does show up and works, ...
1
vote
0answers
20 views

Addition of custom option panel crashes Media Library & Admin Area

So, I was carefully following the Wordpress Codex to create a Custom options panel for a custom post type.(https://codex.wordpress.org/Creating_Options_Pages) Specifically, Example 2. Everything was ...
0
votes
0answers
16 views

Multiple useres editing specified content

I work for a nonprofit with weekly courses for kids. Every week the course teachers update where and when next weeks course will be. We have about 10 courses every week. So the teachers need to be ...
0
votes
1answer
20 views

How to create a custom post type with additional fields?

Beginner's question: Looking for example how to create a custom post type with additional elements. What I mean is: in my code I have a basic stuff like 'title', 'editor' ... but I need also for ...
2
votes
1answer
17 views

How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]

I have added a custom post type called: "Partners", what I want is that when a new one is created, a notification appears in the sidebar of Wordpress. For example: regards!
1
vote
1answer
13 views

Can one create multiple Custom Post Types with a for loop?

I am trying to use a for loop to create multiple custom post types in a plugin. The plugin options page allows users to set the number of custom post types along with the singular and plural names for ...
0
votes
1answer
11 views

Getting used tags per post type

I have three categories: Money, Space, Advice. I use these on a post index page to filter through all of my posts by creating checkboxes for each category type. @php $categories = get_categories() @...
0
votes
1answer
13 views

How do I create a new post upon registration with the users first and last name as title

I've been working at this for some time and for the life of me I cannot figure this out. Here is my code as of now. add_action('user_register','create_new_user_profile', 999); function ...
0
votes
1answer
44 views

Pagination for a cpt filtered with a category

I was tasked with creating a posts aggregator that fits seamlessly into the category nav-bar. For this to work, I could not use the category-list.php that exists, for it is full of workarounds and ...
0
votes
0answers
17 views

Create custom role and capabilities to manage CPT

I have created a job offers plugin with two custom post types job_offer and job_application. Now I'm trying to create a custom user role "HR Manager" with custom capabilities. This user role should ...
0
votes
0answers
5 views

Show woo-commerce products which are related to a specific user with advertiser roles

I have different users registered on my WordPress website with different roles. Apart from the rest of users, I want to allow advertisers (users with advertiser role - advertiser is a custom role that ...
0
votes
1answer
23 views

Specifying meta field's column type in Database using add_post_meta

In my code, I enhance one of my content types by following code: add_post_meta( $post->ID, 'favourite_fruit_code', $value ) All goes well, but I would like to have power over specifying what a ...
0
votes
0answers
17 views

CPT, taxonomy logic and filter

This is more a question on how to attack a problem. And my 1st one also. I’ve added a custom post type – Projects – that has a custom taxonomy – Group. Is it possible to separate the behavior (render)...
1
vote
0answers
16 views

How to make custom posts types display when published for the future

I'm having a hard time accomplishing two things. I've created a custom post type for Events. I would like for the client to be able to post the event by the date. This means publishing posts that are ...
0
votes
0answers
12 views

How do I force a CPT to select a shared custom template in Post Attributes?

I have a custom templates that is used by several custom post types. This code forces the CPT singles to display on the front end using it: function get_custom_post_type_template($single_template) { ...