Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Problem with customize page cached in WordPress.com

I hosted my site on WordPress.com, now having a problem that I have a customize page that will random generate an ID then create and update database records(custom post type)(using wp_insert_post &...
user avatar
  • 1
0 votes
0 answers
16 views

"Menu order" being ignored when querying posts from a parent taxonomy with "include_children" set to true

I have a CPT of articles and a custom taxonomy of collection. This is how the articles are assigned to the collections: Collection 1 Article 1 (menu_order = 1) Article 2 (menu_order = 2) Sub ...
user avatar
0 votes
1 answer
13 views

Problem with custom loop navigation inside the blog page

I have a problem I am not able to solve. I have a custom theme with some custom post types and I need to display an archive for all CPT somewhere in my site. After some reading, I decided that the ...
user avatar
0 votes
1 answer
28 views

On archive.php show loop for child categories if they exist or posts if they don't, on custom post type

I have a custom post type 'sch_keynote', with custom taxonomy 'sch_keynotegroups'. On the archive page I have managed to create two loops, one for child categories and one for posts. I only want to ...
user avatar
  • 11
0 votes
0 answers
8 views

On click some element i want to use some template

I have a page that calls the template, I made filters using a data-filter.These filters sort out the ALU door and PVC doors. However when I click on the pagination and goes to page 2 to list the other ...
user avatar
0 votes
1 answer
13 views

Wordpress giving me the index

i'm having a problem and i can't seem to figure out how to solve it. I'm just beginning to develop custom themes in wordpress and i wanted to create the custom template for portfolio and a single page ...
user avatar
0 votes
0 answers
26 views

Custom Post Type with Different Sets of Post Content?

I have a custom post type called "Industry" and want to allow for a given Industry post to have different sets of post content depending on "Region". The post type would have a ...
user avatar
  • 217
0 votes
0 answers
11 views

Rename existing cpt and taxonomy with new textdomain

I'm developping a small plugin to rename existing custom post type from a theme (Divi). I use this code : add_filter( 'register_post_type_args', 'rename_project'); function rename_project( $args, $...
user avatar
1 vote
0 answers
11 views

How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT

What I have: example.com/movies/{post} <!-- custom Post Type single post, e.g. /movies/batman --> example.com/genres/{term} <!-- custom Taxonomy single term e.g. /genres/action --> What ...
user avatar
  • 11
0 votes
0 answers
13 views

Custom post type set default template using block editor

So i am using the block editor to build a page and I created several custom post types. Usualy I would Just create a template in the classic way but since i want to use the block editor i was ...
user avatar
  • 101
0 votes
0 answers
19 views

"Author" custom post type

I have an existing WP site where there is a custom post type called Author with a few hundred entries. I need to create a single entry page from these authors, but single-author.php just returns a 404....
user avatar
  • 101
0 votes
0 answers
14 views

Not Able to Add New Class To CPT Attachment Image

Testing against WordPress 6.0 and using Codex, get_image_tag_class filter to remove all existing default classes and add new class img-fluid is not working Here is the code that I am using in ...
user avatar
  • 193
0 votes
1 answer
22 views

Custom Post type collection

If you've set up custom types and given them a custom slug through register_post_type 'rewrite' => array( 'slug' => "shoes" ) Can you assign a template for /shoes/? At the moment ...
user avatar
  • 126
0 votes
0 answers
14 views

Is it a connection or relationship between 2 custom post types?

im working on it now for two days and no outcome. I have woo products and custom post types called "lankytinos", what I need to do: You open product and there are the list of "...
user avatar
  • 1
0 votes
1 answer
25 views

wp_get_canonical_url showing first url of the post for custom page

I have created a tag.php page in the theme. It's working perfectly. I am getting the tags post on the page. Now I have added the below link to the header.php page. <link rel="alternate" ...
user avatar
0 votes
0 answers
22 views

Custom Query: Multiple CPTs and a taxonomy filter

I want to create a post feed that displays the following: ALL posts in the CPT 'custom_post_type_1' Any 'post's in the category 'speakers' So far, I have this filter which displays all posts in '...
user avatar
  • 1
0 votes
1 answer
30 views

Wordpress is ignoring my post rewrite rule

I have the following code to change Posts to News, and add news-insights to the URL of every post: function cp_change_post_object() { $get_post_type = get_post_type_object('post'); $labels = $...
user avatar
0 votes
1 answer
23 views

get_post_types - exclude multiple post types by name

I am trying to get an array of all the post types except for attachments and pages. I've been able to do this with one exclusion like this: get_post_types( array( 'name' => 'page', ...
user avatar
0 votes
1 answer
28 views

Add pagination to custom single post template

I have a custom post type ('stories') that uses a custom template (single-stories.php). I'd like to add pagination to each single-stories template that will link to previous and next posts. I'm ...
user avatar
  • 105
0 votes
0 answers
16 views

Migrate Custom Post Type with Custom Fields data and parent child order

Hello WordPress community, I'm trying to migrate my one WordPress custom post type data to another WordPress site and I tried to migrate with SQL and WordPress's default export/import function but not ...
user avatar
0 votes
1 answer
24 views

Custom Posttype URL

I create custom post type code is below function jobs_post_type() { $labels = array( 'name' => _x( 'Jobs', 'Post Type General Name', 'OceanWP' ), '...
user avatar
0 votes
1 answer
34 views

Sortable column with custom data by date

I would like to sortable a column with custom data. I have a custom post type named "events" and I have a custom meta_key named "_start_at". My column is sortable but when I click ...
user avatar
  • 1
1 vote
2 answers
118 views

$pages = get_pages('child_of='.$post->ID); Why arguments are concatenated?

I am reading a book called "Learn to Create WordPress Themes by Building 5 Projects" . In that to retrieve the parent for pages, they have a function to get the parent of the pages. The ...
user avatar
0 votes
0 answers
12 views

Wp Meta Query does not work while simple Query Works

I have created a Custom Post Type and added 50+ posts. Now this post type have some meta values which I need to display. Here is how I created the post type: function colorshadescpt() { ...
user avatar
1 vote
1 answer
41 views

How do I assign a block template (.html) to a custom post type?

I'm using WordPress 6.0 and I've created a child theme from TwentyTwentyTwo. I've created a custom post type using code like this: register_post_type('foobar', [ 'public' => true, '...
user avatar
  • 595
0 votes
0 answers
18 views

Stop displaying Permalink

How to stop displaying permalink when adding custom post Title ?
user avatar
  • 387
0 votes
1 answer
14 views

Address as a content type post

I want to create CPT that have a location address as the title. So the person comes on a page, enter an address, it load suggestions and when he click save it autogenerate the title of the post as the ...
user avatar
0 votes
0 answers
14 views

How can I loop at a Specific Taxonomy from a custom post type?

So I am stuck because I want to loop through post from a SPECIFIC taxonomy. So the Taxonomy is "State" and the post type is "Attorneys" . I have a bunch of attorneys that are in ...
user avatar
1 vote
2 answers
22 views

How to add query args to links to CPT admin submenu

I have a custom post type I've created, and I've added an admin submenu page to display some data it generates. So far, so good. I'm displaying the data with my local extension of WP_List_Table, and I ...
user avatar
0 votes
0 answers
28 views

Can I use the 'category' taxonomy for both posts and a custom post type?

Is there a disadvantage or issue with using the category taxonomy that post uses with a custom post type? For example: $args = array( 'label' => __( 'Item', 'text_domain' ), ...
user avatar
  • 307
0 votes
1 answer
30 views

Update value inside array update_post_meta

I am trying to change default values inside array in custom field. But I am getting error "PHP Fatal error: Uncaught Error: Cannot use string offset as an array" when I try to change the ...
user avatar
0 votes
1 answer
18 views

Change user role when user's first post gets published

On my websites the contributors (user role contributor) are allowed to post posts. All their posts are not published automatically (these posts are with pending status). After approving their first ...
user avatar
0 votes
0 answers
18 views

Search custom type post

I want to make my search bar on the website show custom post type (courses) beside the blog posts. I tried these codes But it did not work. The only thing that worked was the WP Extended Search plugin,...
user avatar
  • 5
0 votes
0 answers
16 views

WP query_posts group by meta field related

Hello Guys i am trying to customize a wordpress theme and am getting this is How it queries All Posts with episodes post_type. My Question Is. this Post type is related to another post_type which is ...
user avatar
0 votes
1 answer
19 views

Get previous and next custom post by custom field

I try to get previous and next post so I do this : $args = array( 'post_type' => 'event', 'post_status' => 'publish', //'posts_per_page' => 1, '...
user avatar
  • 1
0 votes
1 answer
25 views

CPT Columns doesn't show categories

I have the following code creating some Columns and reordering them to my CPT. // SHOW THE FEATURED IMAGE function pessoas_custom_columns_data($column_name, $post_ID) { if ($column_name == '...
user avatar
0 votes
0 answers
20 views

Add Content Column to Custom Post Type backend

I have a basic custom post type: function create_posttype() { register_post_type('guestbook', array( 'labels' => array( 'name' => __('Guestbook Entries'), ...
user avatar
  • 1,113
0 votes
1 answer
18 views

pagination for custom post type archive page

I have a custom post type (gallery). On the archive page, I'm limiting the display to 12 items, with pagination links below. This works as it should, but I'm getting error notices: Notice: Undefined ...
user avatar
  • 3
0 votes
0 answers
17 views

Custom fields for post or terms which don't update on post update

I need to have custom fields for each post and terms. But how can I create these fields which don't update when post or terms is updated in backend. For example: Lets suppose we have a custom field ...
user avatar
0 votes
1 answer
52 views

Save Multiple Metabox values

How to Save Multiple Metabox values ? I have 3 fields like below image. Should I use below code ? if (isset($_POST['name'])) { update_post_meta($post_id, 'name', sanitize_text_field($_POST['name']...
user avatar
  • 387
0 votes
0 answers
20 views

Save Custom Post Value

I am learning WordPress Plugin Development. I have custom post type News. I am taking input using meta-boxes for this custom post. I added metabox using below code. add_meta_box('news_settings', 'News ...
user avatar
  • 387
0 votes
0 answers
16 views

Add custom posts to submenu automatically

I'm trying to automatically add posts from a CPT to a submenu in Appearance > Menus. I've tried following this code suggested by @Bauwb add_filter( 'wp_get_nav_menu_items', '...
user avatar
0 votes
1 answer
18 views

Call to a member function add_rewrite_tag() on null on register_post_type [duplicate]

Im trying to register a post type using the class below, the problem that appears is a fatal error "Call to a member function add_rewrite_tag() on null". I did some research and the general ...
user avatar
0 votes
0 answers
14 views

Display custom post front end filter by ACF equals current user

Let me try to be as clear as possible : I would like to display my custom post on Front-end. I made a Back-office for a mobile app, but I'd like to create an access from front-end to display some ...
user avatar
0 votes
0 answers
37 views

How to get post count of specific taxonomy that have store name & category

I am new in php and trying to learning php. I have taxonomy called dealstore. I have added one store name "Amazon" and two categories name "coupons and electronics". Now, I want to ...
user avatar
  • 1
0 votes
0 answers
17 views

CPT: Enable Gutenberg, but disable editor field

I have a CPT which does not need an HTML/content/editor field. It seems I have to add at least "supports" => [ "editor" ] to the args of register_post_type(), but then it is ...
user avatar
  • 1
1 vote
1 answer
54 views

WordPress notification if new post published

I use WordPress and I want to alert users if new post with post_type = job_post was published. Also I want to show amount of new post. So I add to function.php global $new_job_count = 0; function ...
user avatar
0 votes
0 answers
16 views

how to create hierachial taxonomy and manage under single post type?

i have created Farmers Post type for managing farmers data in wordpress. now i want to create hierarchical taxonomy as below: ->state ->district ->g.panchayat ->village ->farmers Please ...
user avatar
0 votes
1 answer
16 views

Auto Generate Post Title from 2 Custom Fields

I would like to generate the post title from 2 custom fields, 'job', which is a taxonomy, plus 'date' which is a date picker, not the date of the post. This is for a custom post type called 'job-...
user avatar
0 votes
0 answers
45 views

Why will comments not remain open on custom post types?

I have a WP install which makes use of default posts and of one custom post type (reviews). Discussion settings allow comments on both these post types. The comment form is present when viewing posts ...
user avatar
  • 29

1
2 3 4 5
203