Questions tagged [custom-post-types]
Custom Post Types extend WordPress to support additional content.
10,120
questions
0
votes
0
answers
21
views
Permalink with hierarchy of Custom Post Types
We have a site where we have the following structure:
www.example.com/volume-number/book-title/chapter-title
We do this hierarchy by creating the Chapter pages as child of a Book page, which in turn ...
0
votes
2
answers
32
views
How do I set a post slug automatically based on taxonomy?
I have a hierarchical CPT event with taxonomy event_category. One of those categories is "Recap". When a user saves a post (could be draft, publish, or edit existing), if the event_category ...
0
votes
1
answer
39
views
Custom archive page for custom taxonomy and pagination issue
so this is something I am trying to figure out for quite some time about my custom archive page for a custom taxonomy 'workplace'. There is many workplaces, and what i want is to display the products (...
0
votes
0
answers
14
views
Get a list of custom post type (property) when clicked on custom taxonomy 1 (rent or sale) from custom taxonomy 2 (city) page
I have 3 different custom post type (property) and taxonomies (city and type).
I can retrieve
all properties from each city from taxonomy-city.php
all properties from each type (sale or rent) from ...
0
votes
1
answer
19
views
Ordering by meta value not working
I have set WP_Query to order by a meta value but it isn't ordering correctly for some reason. entry_key is a year but is stored as text eg: 2022
$term = get_queried_object();
$args = array(
'...
0
votes
1
answer
14
views
How to divide Subcategories into pages of parent category wordpress
suppose I have sturucture like this:
Justin Bieber > Albums > Justice
when I visit on https://example.com/category/justin-bieber/albums/
It is showing all albums of Justin Bieber category. but ...
1
vote
1
answer
59
views
Disable featured image
From the description of the plugin "Hide Featured Image":
There are instances when one wants to show featured image on single
post and hide it on another post. This plugin will allow you to ...
0
votes
1
answer
24
views
Question about link two types of data in wordpress
I have a problem and I'd a like a suggestion to solve it. I have two data(Architects and Projects) where both need to link each other, architects must have their own page as well as an archive page. ...
1
vote
1
answer
41
views
Send email button in custom post type backend
I've added a button in the backend of my custom post type editor.
I want to send an email using wp_mail() when admin user click a button.
I've added this custom form and button to a meta box. See ...
0
votes
0
answers
25
views
Custom post type with rewrite slug as / has 404 issue in other post type. How to fix this issue
I have a issue in custom post . When i add below statement and save the permalink, custom post url works well but urls of default post, page and other custom post shows 404 error:
'rewrite' => ...
0
votes
0
answers
9
views
Custom post type and multi taxonomies + customize url
I have a custom post types course and two taxonomies type and location
sample:
Type
Math
Pure Math
Applied math
...
Location
London
Trafalgar
Leicester
...
For now I manage to show permalink ...
0
votes
0
answers
20
views
How to hide list from custom post type
Is there any way to hide post list from custom post type that I have created. Your answer would be really help.
0
votes
0
answers
8
views
Display All Courses in Course Archive Page
I am Developing Course Management Website.
I have main post type Course, under Course I have different taxonomies like Institution, Location, Course Type and etc..
The problem is, if one Course ...
0
votes
2
answers
18
views
Custom Post Type Dashboard Tab not displaying any posts
I created a custom post:
/*= Add Custom Post Type: Board Members
/****************************************************/
add_action( 'init', 'create_board_posttype' );
function create_board_posttype() ...
0
votes
0
answers
21
views
How to display "Trash" in my custom post type?
what does it take to display the Recycle Bin in my own Custom Post Type?
function my_custom_post_specialist() {
$labels = array(
'name' => _x( 'Terapeuci', 'post type ...
0
votes
0
answers
26
views
Adding Category Name in Slug in Custom Post Type
I have created Custom Post Type without using plugin i.e. via Meta Box Post Type Generator.
add_action( 'init', 'your_car_register_post_type' );
function your_car_register_post_type() {
$args = [
...
0
votes
0
answers
15
views
Hide title field of selected post-types on edit pages
My question is how to hide the title field on the edit page of a cpt that has a title field
here hide litteraly means do not display or do not show, or do not offer the possibility to be edited "...
0
votes
0
answers
38
views
Sticky posts limit query and pagination for a custom post type
I would like to display 9 posts per page. But, when I have a sticky post, I would like it to be integrated in the 9 posts in the query. And, then, for the second page, I continue to have the next 9 ...
1
vote
2
answers
31
views
How to add content to a post tied to an Archive template specifically for a custom post type
I'm on wordpress 5.9+ and creating CPT's has become relatively easy. But having a landing page for a CPT is new grounds for me.
I have successfully created a custom post type called Career Finders
I ...
0
votes
0
answers
16
views
Custom wp-query display post only today
I have a problem. My query not display the post only today.
$today = getdate();
$query = new WP_Query( array(
'post_type' => 'tips',
'posts_per_page' => '9',
'order' ...
1
vote
0
answers
28
views
How do I create an archive page as a <table> including metadata?
I'm really struggling getting this seemingly simple thing to work. I have a list of "vendors" as a CPT. They have metadata like "contact name" and "last invoice date". I'...
0
votes
0
answers
39
views
Add Tags to a Custom Post Type from a FrontEnd Form
I have a code that allows users to submit content from the front end of the site, like this.
if(isset($_POST['submit'])){
$title=$_POST['title'];
$body=$_POST['body'];
$difficulty=$...
0
votes
0
answers
13
views
Archive page of CPT's custom Taxonomy
I have a Custom Post Type: "Sponsors"
Sponsors have a Custom Taxonomy: "Sponsor Ranks"
Sponsor Ranks are divided like Platinum Sponsors - Gold Sponsors - Silver Sponsors and so on
...
0
votes
1
answer
22
views
Translate website without duplicate custom post
I have a website where anyone can post jobs from frontend. The jobs pages are rendered by custom archive and single pages in my custom theme.
I want the website to be multi language with switcher. The ...
0
votes
0
answers
18
views
Need to edit author permissions | custom taxonomy
I created custom taxonomy (like category) for default post.
I want to change access permission for this taxonomy. Like below
Admin can edit, create on this custom taxonomy. But Author can't edit, ...
0
votes
1
answer
25
views
One Custom post type 404's others don't
I've created 7 custom post types and all but one works. I don't even know where to go from here. I've flushed my permalink structure, and that didn't work. The following code is the array that I'm ...
1
vote
0
answers
18
views
Sort by alphabetical order archive.php page
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
?&...
0
votes
1
answer
42
views
sortable columns for multiple custom post types not working
I have two custom post types named professor and campus.
To each of these CPT's I have added two custom admin columns named image and last_modified, which currently display correctly on both CPT's ...
0
votes
0
answers
21
views
no_rest_route in Unit Testing for REST endpoint for CPT registered via show_in_rest
I've created a REST route for custom post type 'book' by passing
'show_in_rest' => true,
as args in register_post_type('books', $args);
So, when I enter in URL https://localhost/wordpress/wp-json/...
0
votes
0
answers
39
views
Pagination in custom post type archive.php not working
// Get Limited Posts per page
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => 3,
);
$posts = new WP_Query($args);
function.php
// Create Pagination
function ...
0
votes
0
answers
20
views
wp_query can't get max_num_pages in custom post type
Array of query gives to me to different value for max_num_pages
[post] => WP_Post Object
(
[ID] => 628
[post_author] => 1
...
0
votes
0
answers
14
views
WordPress CPT Taxonomy Dashboard Search - How to include taxonomy in search?
I am having great difficulty extending my Custom Post Type (CPT) with custom taxonomies to have taxomonies that are searchable when viewing the posts in the WordPress Dashboard.
The CPT's and ...
0
votes
1
answer
29
views
Why WordPress is picking archive.php instead of page.php?
I have a Custom Post Type (CPT) called "Careers" with "careers" as slug.
I created my Careers listing page with Elementor (the page slug is also "careers"), dropped the ...
0
votes
0
answers
24
views
Can I automatically assign a page template to a custom post type (i.e page-slug.php file)
I am making my first WordPress theme and I am trying to assign a page template to my custom post type automatically. (i.e page-slug.php)
As an example: you can make a page file in WordPress called ...
0
votes
0
answers
6
views
how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
I have created a cpt named blog. Registered taxonomy for blog as blog_category. I have a taxonomy-blog_category.php for displaying all categories of blog. When i click on a category the url i get is:
...
0
votes
0
answers
15
views
CPT : Next or Previous term link when has not adjacent post
My structure is like this :
Book name (cpt)
--- chapters (taxonomy)
-------- chapter 1 (term)
-------- Chapter 2 (term etc)
I have some posts into "book" added in terms
I wish in single-...
0
votes
0
answers
18
views
Admin Posts Table Filter
I have custom posts with meta field idcrm_contact_user_id. I try to filter posts table by this meta at admin page. But it doesn't work. I change selects and url is changing to edit.php?s&...
1
vote
0
answers
22
views
Create a custom post with custom post-metadata with WP API
I'm using WP API to insert a custom post in Wordpress. The custom post is "property".
What I now need to do is assign that post a "metadata" (DB table "wp_postmeta")
At ...
0
votes
0
answers
9
views
CPT loop doesn't seem to account for post date?
I have some custom post types called "products", all with different published dates. Below is my loop that grabs these posts:
$args = array(
'post_type' => 'product',
'...
0
votes
0
answers
12
views
Custom taxonomy, post type, and URL permalink structure
We want a simpe CPT called resources, and when creating each entry in this type, we need categories (taxonomies) that should show up as a checkbox list of category on the right hand side in the admin ...
0
votes
0
answers
27
views
How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
I have an ACF text field for a CPT that is holding a date in DD/MM/YYYY format (it's a text field and not a datepicker field as the data was imported from a CSV file).
My Wordpress loop then sorts by ...
0
votes
0
answers
75
views
posts_per_page in custom WP_Query does not override "Reading" settings?
I am trying to use WP_Query loop (below) to show all instances of a certain post type.
(This loop is not in the custom post type’s archive — it is in a template part that appears as a page section on ...
0
votes
1
answer
37
views
I need to add a filter to prepend the term 'National - ' to the post title if the post is tagged to multiple states
I am trying to add a filter to add the word "National - " to the beginning of the the post title if the post has multiple states that it is in.
Here is a screenshot:
I just figured out the ...
0
votes
0
answers
11
views
Import Recent Posts Only and Ignore old ones if exist
I'm using MailChimp Campaigns Plugin where it imports all Mailchimp campaigns as a custom post type on the website. The app works perfectly however I'm modifying the process to import recent posts ...
0
votes
0
answers
48
views
Is it possible to pin a post in second position from top
as the topic says i wish to keep a post not on top but in second position so that new posts are on top while one of my choice will be just after the latest.
Is that possible, can't find a plugin that ...
0
votes
0
answers
55
views
need click to clipboard button on my site
I'm using this code
<!-- The text field -->
<input type="text" value="[gamipress_referral_url]" id="myInput">
<!-- The button used to copy the text -->
...
0
votes
0
answers
31
views
How to search post titles with whole words only, but not the exact word only?
I'm using WP Custom Fields Search plugin for my search but am searching the core post title field. The default search is including results where the word is part of another word. For example, ...
0
votes
1
answer
24
views
Display all Categories except ones with a specific parent
I'm trying to display all post-categories except those who have an specific parent-categorie.
Can someone help me?
This is my current code:
<?php
$categories = get_categories( array(
'orderby' =...
0
votes
1
answer
115
views
Custom post category name showing empty
I have a custom post type and category. I have the below function on my page. I am getting the post but I am not getting the category name on the page.
I am getting the empty array
array(0) { }
...
0
votes
0
answers
34
views
Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
Very much hoping that somebody can help me out.
Currently creating my own Ajax Post Filter, using https://rudrastyh.com/wordpress/ajax-post-filters.html as a template. Is it possible to split one ...