Questions tagged [custom-post-types]
Custom Post Types extend WordPress to support additional content.
10,290
questions
0
votes
1
answer
35
views
Have Custom Taxonomy Slug Fall Under Custom Post Type Slug
Currently scratching my head as to how to get this to work.
I have registered a custom post type "guide", and have a custom taxonomy for the post type of "venue-type".
I am trying ...
0
votes
0
answers
100
views
How can I show a field ID in Elementor with Request Parameter
I have a ID Field called name and I need get this field in Elementor.
I don´t know if it show as get, post or queryvar.
Please, I need help
Maybe with
add_action( 'elementor/query/nameid', function( $...
0
votes
0
answers
20
views
Custom post type pagination conflict result in 404
we have post type reviews with the slug customers and archive page as customers/customer-stories
we have created page customers and want to show on this page posts from different post type.
it does ...
0
votes
2
answers
69
views
WP Query - Can't get posts with specific taxonomy
I can't get my custom posts with a specific taxonomy. Here is my code in functions.php :
function portalp_custom_post_type_realisations() {
$labels = array(
'name' => ...
0
votes
1
answer
44
views
Adding Taxonomies to Custom Post Type Without Displaying Blog Post Categories
I am running into an issue that I am trying to fix. I first needed to find a way to add a category page to custom post type. Which I was able to do with this following code added to the mu-plugin file....
0
votes
0
answers
149
views
Query order by a numeric ACF field
I created a query for the custom post type of "departments" the query gets me every department with ACF field "type_of_cetifecate" = "bach" and with a certain category id,...
0
votes
0
answers
40
views
Allow child pages with the same base as the CPT slug
I use WordPress, but I don't use the archive templates, nor the default post. Instead, I create a CPT that will function as my blog, and I use regular pages for archives. This gives me a minor ...
0
votes
0
answers
18
views
Mixing custom post types and standard post types is distorting page layout
In simple terms when I include any custom post type and standard post in one archive page of any type the layout is somehow distorted. The sidebar looks different and sidebar widgets are moved to ...
0
votes
0
answers
13
views
Wordpress taxonomy and terms question
what i want to do is compare orcs from the game shadow of war.
I have an idea of what I need to do, but I a not sure how to use wordpress taxonomies, categories and tags.
I know enough php that could ...
0
votes
0
answers
33
views
Load style and script for custom post type metabox
I'm using this code to try loading some custom assets for a custom post type I have registered
public function setup_theme_backend_assets($hook)
{
$screen = get_current_screen(); ...
0
votes
2
answers
911
views
upload image with rest API to the media library
I am working on uploading an image to the media library and then attaching it to the featured image. I put the code below in my functions.php file and submitted a JSON file through postman, but for ...
0
votes
0
answers
32
views
Create a WordPress loop that shows posts from a custom post type + filters the posts by taxonomies while hiding empty taxonomies
I am working on a page template for a custom post type where I need to only show posts that are tagged for a certain sport in a custom taxonomy. I am also displaying all posts that are tagged to that ...
1
vote
1
answer
46
views
How do I add the "orange counter" next to a Custom Post Type?
I'm currently building a plugin for a client, where users can book meeting-rooms from the frontend. Then AJAX will create a custom post type, and an email will be sent to the site administrator. All ...
0
votes
1
answer
54
views
public custom posts not showing in my wordpress plugin
I am building a WordPress plugin and I want to show all publicly registered custom post types (by theme or other plugins) in my plugin. But it only shows post and page custom post types not other ...
0
votes
0
answers
18
views
Custom CPT - Programmatically create categories to assign CPT when a new one is created
I'm creating a CPT using this code in my OOP plugin
register_post_type(
'products',
[
'label' => __('Products', ''),
'description' =&...
0
votes
0
answers
40
views
Wordpress post objects in one parent post object
I'm creating an event page where we can add an event line-up. Such a line-up consists out of different speakers.
So I've create two custom post types:
Line-up
Speaker
On my event page you can select ...
0
votes
1
answer
251
views
Wordpress Multisite Network Shared Custom Post from Main Site using single-CPT.php
Trying to share a Custom Post from main site to a child site on a multisite network.
I am 80% there, with the use of switch_blog I am able to query custom posts on my templates on the child site. I DO ...
0
votes
0
answers
28
views
Remote database access on another wordpress site's custom post type
Firstsite.com
secondsite.com
both are Wordpress site and firstsite's data I want to fetch on my secondsite's custom post type template.
Secondsite.com has it's own database so I want to use both on ...
0
votes
0
answers
18
views
How to change permalink structure off default posts and also CPT's posts
For example, I need "name of post type / name of post" when I am on single post page and when I am on category page it must look "name of post type / category / category name"
0
votes
0
answers
27
views
Cannot attach custom taxonomy term to a custom post type. Post taxonomy terms are not saving
I have a custom post type with five different custom taxonomies attached to it. Of those 5, I am unable to add taxonomy terms to posts. However, the other four taxonomies are saving just fine!
Here is ...
0
votes
1
answer
21
views
Change post-name when inserting new Post if Specific Category is selected in WP
I want to hook a function for first time when new post is being inserted in WP.
when Poetry category is selected I want to change post-name with random 7 numeric numbers like
/poetry/2837410/
which ...
0
votes
0
answers
67
views
How do I get parameters from the URL?
I have to be missing something obvious, but darn me into wool socks if I can figure out what it is.
I have a set of news articles in the custom post type news. I'm trying to get an archive page ...
0
votes
0
answers
60
views
Custom post type single page fine for admin, 404 from front
When logged-in I can open post type single page (mysite.com/evenements/sample-slug)), but the same URL throws a 404 page if I'm not logged-in
Sometimes when logged in, I edit a given single page then ...
0
votes
1
answer
60
views
plugin translation *.mo file not getting loaded for custom post
I'm encountering a weird behavior with the translation for a custom plugin I've made for a customer.
The translation files are in the plugin languages folder and I load them with ...
0
votes
1
answer
80
views
Dynamically count the number of custom post types associated to a custom taxonomy
I have two custom post types, "participants" and "reports". Both of them are associated with the custom taxonomy "year".
So in the post "report 1" that is ...
0
votes
0
answers
26
views
Meta_query question
There is a problem with compiling a request to display posts by meta_query.
Need to output posts whose title contains a substring.
Can't figure out where I'm wrong. Can someone help?
$inputValue = '...
0
votes
0
answers
115
views
Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template
I have an Elementor Loop Item Template that is used to display posts from a custom post type called "Project Photos."
I want the ability to filter the results based on the following 4 ...
2
votes
1
answer
244
views
CPT template is not being automatically used single post pages
I created a plugin and added a custom post type to the plugin. I then created a template using the hierarchy single-{custom-post-type}.php. So my cpt slug is wppro-events and the single post template ...
0
votes
1
answer
197
views
Custom slugs with dates & IDs on Custom Post Type
Trying to do something with the rewrite argument on custom post types.
I'm after 2 different things here for 2 different custom post types.
1: Slugs which look like this
post-name-year-month-day
So ...
0
votes
1
answer
47
views
How to make posts under custom post type not generate a URL / post
I have a custom post type called integrations, which is being used to host basic information for integrations.
Here's how I've registered the post type:
register_post_type(
'Integrations',
...
0
votes
1
answer
60
views
How to automatically compare date from custom post type with current date and change taxonomy based on a result?
I have a local WordPress website installment. I have custom post type "tours" and a custom taxonomy connected to it called "active-past". This taxonomy has two terms "active1&...
0
votes
1
answer
111
views
How to make multiple custom taxonomies sit under custom post type slug?
I have a custom post type called resources which has been registered as so:
register_post_type(
'Resources',
theme_build_post_args(
// $slug, $singular, $plural
'resources', 'Resource', '...
1
vote
1
answer
32
views
How can I produce multiple webpages with a different output based on one entry/Page/custom Page?
My problem:
I have a custom page format for events. Now I would like to get different outputs for each of these events.
Normal webpage › for visitors
Custom look › for easy copy and paste to other ...
0
votes
1
answer
618
views
Custom post type REST api 404: Updating failed. No route was found matching the URL and request method
I have registered a new post type as:
$this->sconfig= ['post_type'=> 'event', 'slug'=>'events'];
add_action('init', array($this, 'register_event_posttype'));
and
function ...
0
votes
2
answers
357
views
Set the title of a custom post automatically by using info from custom fields?
I've set up a CPT via a plugin, including custom fields for first and last name, so I'd like to automatically make the post title "First Name + ' ' + Last Name".
This post almost got me ...
0
votes
1
answer
76
views
Why do I get a 404 error on my custom post type archive pagination?
When I try to set up pagination on my custom post type archive page I get a 404 if I click on the next page. The first page works fine. Any idea what I'm doing wrong?
<?php get_header();
?>
&...
0
votes
1
answer
34
views
How do I exclude the current post from the upcoming post query
Summary: I have a page template with 3 queries.
Current Exhibition
Upcoming Exhibition
Past Exhibition
The dates are custom fields. The problem I'm having is, how do I dynamically exclude the ...
1
vote
2
answers
706
views
Custom Sort Order for Custom Post Type Taxonomy
I have a custom post type - Demo Tours
And for that CPT I created a Custom Taxonomy - Demo Tour Categories.
Each Demo Tour may have one or more category.
Each category has Custom Field - Category ...
0
votes
0
answers
27
views
WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query
I'm having one Custom post type I have added a Sticky Option to that Custom Post Type. When I choose the post as sticky means it's not working for me.
I have tried the below code.
Please don't add ...
0
votes
0
answers
17
views
Show content from pages based on Current Date
I am designing a site and trying to recreate this page structure https://www.britannica.com/on-this-day . For This I created a CPT named On-This-Day. Inside On this day post type there are two type of ...
0
votes
1
answer
238
views
Save_Post change Custom Post Type Post title to post id number
I have a Custom Post Type with the slug of "sightings".
I do not need a post title, so I have removed the functionality - but now the posts are being saved as (no-title).
I read about the ...
2
votes
1
answer
28
views
Is it possible to use a post name in a custom post slug?
So I have custom post type called Lessons and I am using something like this for the slug
register_post_type( 'Lessons',
// CPT Options
array(
'labels' => array(
...
1
vote
2
answers
293
views
Replace the custom post type permalink
I am quite new to wordpress and I'd like to know what I am doing wrong here:
I've created a custom post type, let's say, custom_post_type_jobs.
And I have a page which is called jobs.
When I create a ...
1
vote
1
answer
140
views
How to make content as required in custom post type?
I created custom post type Testimonials and made the title required using the code in this link:
Require title for pages
Now I applied the code in order to make the content required, and it works fine....
1
vote
1
answer
25
views
Complex Custom Loop with Includes
The Problem
I have a complex loop designed for showcasing my portfolio.
Here is the criteria:
Portfolio is powered by a custom post type called PORTFOLIO
Each post will be assigned a class of either '...
0
votes
0
answers
23
views
Custom post type with custom taxonomies structure url not working archive of CPT
I trying to adjust url structure for CPT(collections) and custom taxonomy(collection).
To create full url like (page.com/collections/collection/cat/subcat I'm using
'rewrite' =&...
0
votes
0
answers
90
views
Modifying post_type_link hook messing up edit function for a custom post
I'm using Wordpress as a headless CMS. I have several custom post types that are being consumed by a non-Wordpress application via WP's REST API.
On the custom posts, I would like permalinks to the ...
3
votes
1
answer
45
views
What is the best way to relate different custom post types?
Let's say I have 3 CPTs: series, seasons, and episodes.
Now if I post in these custom post types the URL would be:
Series CPT > post name: sample serie > URL:
site.com/series/sample-serie
...
0
votes
1
answer
53
views
Wordpress does not show the custom fields box
I have created a new CPT in my wordpress locally at the moment, I need it to have custom fields and I have added it so that it does.
the code:
register_post_type( 'centro_de_recursos',
array(
...
0
votes
0
answers
35
views
Create a hierarchical list of posts that's grouped and nested by category
I'm trying to show a list of book recommendations, grouped and sorted by category. The problem is some book recommendations belong only to a top-level category and some belong to sub-categories.
I'd ...