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.

1
vote
1answer
44 views

Can't query tag and post_type at the same time

On my developer site this query is used for a carousel in index.php : $vedette_accueil = new WP_Query(array( 'tag' => 'vedette-accueil', 'nopaging' => ...
0
votes
0answers
30 views

Why is my site using index.php instead of archive?

Developing my first custom theme and I started out using an individual page-$slug.php to display a list of each custom post. Have since learned that archive.php is better for this purpose (but I just ...
0
votes
1answer
32 views

Dynamic CPT / Taxonomy

I use multiple CPT / Taxonomies / Terms in my website. Currently, to customize, and use the good WP template, i've made a taxonomy-$taxonomy.php file for each CPT. But in fact, it's ONLY the CPT and ...
0
votes
1answer
32 views

Custom post type permalink returns 404 when set to private

I have a custom post type that is configured to use a permalink structure prepended with the post type name. When using get_permalink(), the URL that is returned does not include the post type name. ...
0
votes
0answers
18 views

Wordpress doesn't respect Page slug in custom post type url pagination. Keeps getting removed

I have a custom post type, Company, with respective company child pages. Whenever I attempt to go to a page url eg. http://example.com/company/example_company/page/2, the /page/2/ gets striped from ...
0
votes
1answer
13 views

read_post meta capability for anonymous users

read_post is a meta capability that can be used to check if a user can read a post. It can be used, for example, like this: if ( current_user_can('read_post', $post_ID) ) { // do something } No ...
0
votes
0answers
11 views

How can I use one instance of page.php to display different custom post types?

At the moment I'm using multiple page templates to display custom posts (page-events.php, page-resources.php) and it seems wasteful. How can I reuse page.php and just display the post type relating ...
0
votes
0answers
30 views

Allow duplicate slugs for custom post type with taxonomies

I have set up a custom post type (team) and a custom taxonomy (team_tax) for this post type, both with the same slug. Down to the core: register_post_type( 'team', array( 'labels' => ...
0
votes
0answers
25 views

current-post-parent for custom post type

I have 2 archive pages on my site. First "News" is for standard wordpress posts. Second "Projects" is for my custom post type. When I go to specific post from "News" archive then my menu position "...
0
votes
1answer
54 views

Rewrite custom post type with taxonomy

On my WP blog my goal is to rewrite urls like: domain.com/blog/**name_of_a_city**/title-of-the-article Until now I have all my links written like this: domain.com/blog/title-of-the-article/ Since ...
-1
votes
0answers
27 views

Function not working on admin panel of custom post type

I am using the code below to add a column to my admin panel. The code works fine to show the page views from my posts. The problem is that it does not show the number of views of my custom post type ...
0
votes
1answer
15 views

post_row_actions not working for hierarchical post type

I'm working on a plugin where I have a Custom Post Type (CPT) registered and I need to add custom row actions to that particular post type. But could not make the following code hooked to ...
1
vote
0answers
37 views

WooCommerce Customer Role Delete Custom Post Type

WooCommerce customers are creating custom posts using Gravity Forms and then the customer is assigned as the author of the post. The custom post type is set up using the CPT UI plugin. I have this bit ...
0
votes
0answers
14 views

Query for get the “Sticky post” of a CPT with 2 taxonomies

I am new in WordPress and I am doing tests, I have created a CPT called ('company') with two taxonomies ('zone' and 'sector'), I want to show me the companies with a certain sector (sector term such ...
0
votes
2answers
25 views

Show all Tags in each post

I have created a new post type named "Project". And I registered 1 taxonomy "Tags" in it as follows: https://pastecode.xyz/view/844258b1 I entered the tags into 1 article in post type "Project". If ...
0
votes
0answers
34 views

WooCommerce 3+: Get Order Items

I want to sell a CPT "bet". So if you buy the product you will be enrolled and eventually get a payout. My problem is that I need to update the post which was bought and increase the payout value and ...
0
votes
1answer
30 views

Is it possible to arrange Custom Post Types from CPTUI into a Folder?

I'm using CPTUI to create taxonomies and categories for Facet-WP, which i'm using to sort and filter products on the pages i'm creating. This is the problem i'm facing :- As you can see, the Custom ...
0
votes
0answers
17 views

Standard Page Child of CPT Not Found (404)

I am about to lose my mind figuring this out. I have a custom post type called "portal" and posts of that type can be the parent of a standard page. To accomplish that I've written code that adds the ...
0
votes
1answer
17 views

Custom posts of one type have disappeared from admin. Still appear on site [closed]

At some point this morning I realised that all of my custom posts of one type ('resources'), have disappeared from admin, the section is still there yet says 'no posts found'. Another type, 'contacts' ...
0
votes
0answers
40 views

Custom Post Type parent/child relationship rewrite rules for permalinks

I have been working on this for quite awhile but I'm stuck at rewriting the permalinks for both the parent and the child. So I created two custom post types: magazines and magazine-pages both MUST be ...
0
votes
1answer
21 views

Mutiple Select only POSTing 1 value

In a custom post type edit form, I have a select marked as multiple to allow multiple items to be selected: <select multiple size="6" name="product_ids"> <option value="71">First</...
0
votes
1answer
21 views

Should i use a plugin for Event Manager or code my own needs? [closed]

I own a local guide on wordpress, with already many CPT like "hotels, bnb, markets, etc..." all those CPT are linked by relational field to a city. ( city is CPT as well ) Now, i wish to add a EVENT ...
0
votes
1answer
20 views

Restrict Custom Post Type to One Item

I'm looking to build a plugin that stores settings for a companion app my Wordpress site works with. I've gotten to the point where I have a custom post type mobile_settings that stores labels and ...
0
votes
2answers
34 views

Is it possible to show multiple (custom) post types at the wp homepage only by using pluging code?

I am developing a plugin and I want to show my custom post type (projects) next to the standard post type posts. I know I can do this by adding some code to the themes functions.php. But is it ...
0
votes
1answer
18 views

how to post default thumbnail if post not created yet

I want to show a default thumbnail if a custom post not created yet. Here is my loop: <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <?php if ( ...
1
vote
2answers
29 views

Get all Posts If has same custom field values in Posts

I am trying to get a list of posts if has same zipcode values. Thanks in advance for the help. <?php $query = new WP_Query( array( 'post_type'=> array('service'), 'posts_per_page' => -1, ...
1
vote
1answer
19 views

Broken featured images are uploading from frontend

I have a form at frontend i want to create post from frontend everything works but when i upload featured image , broken featured image is uploading. I saw uploads folder the image exists there but i ...
0
votes
0answers
12 views

relationship between custom post type?

I created a custom post type called 'COURSE' and another custom post type called PROFESSOR. I want the course register to have a selection field (meta_boxes) with the teachers already registered. Is ...
0
votes
1answer
13 views

Unable to format dates to put in event calendar

What i want to achieve is to get dates through get_post_meta and push them in array and passing it into js code. But when i use below code first post in loop's dates gets formatted and other posts ...
0
votes
0answers
13 views

Creating and editing page link w/ CPTs

I have multiple custom post types (CPT) and include them in other posts. When a editor views the posts I want to have a link to create and edit the missing CPTs. I have it set-up that on page load ...
0
votes
0answers
23 views

How to display list of most popular posts from custom post type

I have a custom post type for articles with a custom taxonomy for topics. I wanted to keep this separate from the standard Wordpress blog (posts) which is why I created this. I want to show the 3 ...
0
votes
0answers
9 views

Set Adjacent Post By Alphabetical Order for Custom Post Type in Multilingual Site

In order to apply chronological order with posts and alphabetical order with a certain Custom Post Type, let's say, "animals", displayed through a single-animals.php template, I found this snippet ...
1
vote
1answer
31 views

Custom post type show on both Home and Date Archive

Found below snippet to pull posts from a custom post type 'pictures' into the home page and date archive page.. Added to functions.php this works for home page: function ...
0
votes
1answer
19 views

Related posts by taxonomies does not work , what could be the reason?

everybody. Related posts by taxonomies does not work , what could be the reason? $tax_IDs = array(); foreach ($tags as $tag) { $tax_IDs[] = $tag->ID; } $args = array( 'post_type' => '...
0
votes
2answers
13 views

Get an array wich contains the post_name of every post that has the custom post_type “pelicula”

I need an array that contains all the posts names that match with the post_type"pelicula"
0
votes
1answer
24 views

How to approach a site where it has sub-businesses, each with its own pages (“articles”, “staff”)? Don't want to use WP multisite

The structure would be something like this. Main site About Us Our Staff Person A Person B, etc Catering Service About Catering Service Staff of Catering ...
0
votes
1answer
35 views

Attempting to get number of grandchildren of page in WP_Query loop

I have a custom archive page(with map and location data) for a custom post type. Due to how the locations are hierarchal(state, city, location), I want to show the states only on the archive page, ...
0
votes
0answers
27 views

Display first post of a term in taxonomy template

I have my template taxonomy-$taxonomy.php (here, 'catmaison'). In this taxonomy, I have 3 terms ('au-fil-du-temps', 'elaboration-distillation', 'plantes-epices'). Each terms of this taxonomy are ...
0
votes
1answer
30 views

Display 3 level taxonomies

I'm a bit confused how to handle this kind of output. I suppose to display three level taxonomies. When a term is clicked i still need to display his level brothers but also his children's... The ...
0
votes
1answer
15 views

How to add a lightbox to class mix?

I have a question: how to add a lightbox to a photo. I've been sitting here a bit and I can not deal with it. <?php //Dynamic Portfolio With Shortcode function portfolio_shortcode($atts){ ...
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
24 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 ...