Questions tagged [post-type]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
605 views

How to set “manage categories” capabilities on a post type taxonomy but not on the general categories?

I want to set "manage_categories" capabilities on a post_type taxonomy but not on the general categories? I've added to register_taxonomy: 'manage_terms' => 'manage_categories', ...
0
votes
1answer
8 views

How to add post type in masonry posts elementory widget

When I try to create a website using Wordpress 5.2.2. I found a widget called Masonry Posts in Elementor Panel. But when I added the widget and checked there is no option to choose the post type. We ...
0
votes
1answer
14 views

Filter by Post Type

I'm trying to figure out how to filter the posts returned by post type. I have a list of checkboxes of my different post types, and using that, I've gotten an array of the post types wanted; $...
0
votes
1answer
9 views

How to get all CPT names into WP_Query 'post_type' parameter?

hello I want to display post based on his ID. This post could be a default 'post', 'page' or other registered custom post type. In query I sould specify all CPT names which I want to use, for eg. '...
0
votes
0answers
17 views

Adding post_type filter on pre_get_posts gives 404

I have a basic WordPress query: $the_query = new WP_Query(array( 'post_type' => array('post'), 'posts_per_page' => -1, 'ignore_sticky_posts' => true )); But if I try ...
0
votes
0answers
15 views

Custom theme index layout not displayed correctly

I'm making a custom theme that I'm planning to sell. I'm reading some guides about themes creation, I have already experience with wordpress but this time I want to make a nice theme. I'm facing a ...
0
votes
1answer
18 views

Custom slugs for Each Tab

I have a website for musicians information. The information is divided to few different subjects, using tabs - 'General', 'Songs', 'Albums' and 'Videos. <?php if($tab_story){?> <li role="...
0
votes
1answer
36 views

Custom post type single with custom URL structure

I have a function that rewrites the URL before post slug including a custom taxonomy function wpa_show_permalinks( $post_link, $post ){ if ( is_object( $post ) && $post->post_type == '...
0
votes
2answers
20 views

multible shortcodes (for differnt values) with one function

I am trying to create a function whicht has different shortcodes as output. I have the post-type => womos and the field => personenzahl. The field has the values 1 up to 7. Now I need a shortcode for ...
0
votes
0answers
19 views

Permalink like example.com/taxonomy/post_type/postname

I would like permalink structures like this: example.com/%post_tag%/post_type/postname for posts example.com/%post_tag%/post_type for archive page of post_tag filtered with custom post type archive ...
0
votes
0answers
11 views

Post type switch on front by post author

It's really nice to write first post here ;) Ok, let's get started. I have 2 custom post types - 'actual' and 'finished'. On 'single-actual' i want to have a link that when author post click then ...
1
vote
1answer
17 views

View the number of entries recorded per day

I want to display a chart of the number of articles published from a post_type within a specified time period (e.g. 30 days). Example : 1/1/2019 (1) 1/2/2019 (15) 1/3/2019 (0) 1/4/2019 (6) 1/5/2019 (0)...
0
votes
1answer
253 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
1answer
212 views

How to get Post Type from the functions.php file

TLDR: How can I get the post type within the functions.php file? I am trying to add the following code only when the post type is a 'page' and not when it is a 'post.' However, I am not able to call ...
0
votes
0answers
24 views

google index an Post type page I do not want

I created a Custom Post type for my client's site, and everything works fine. but, I found that google index an archive page that I do not want. here is the code of my Post Type: $...
0
votes
0answers
66 views

Query multiple Post Types that have the same Taxonomies with different Terms

I have a method that works. However, it's not very optimal and limits WP_Query's functionality (recently with pagination). I saw a similar question/issue, but the answer provided is the current ...
0
votes
2answers
18 views

How do you determine if a result in a search query is a post or a page?

I thought this question would be an easy find on the internet… however, it seems no one has ever ran into this issue before. There's no problem in listing a search query when you enter your search ...
3
votes
3answers
5k views

Overwrite rewrite-slug of built in post-type 'post'

I need to change the rewrite-slug of the built in post-type 'post' to 'example.com/magazine/news/any-nice-news-item'. When I re-register the post-type 'post' and set the rewrite-slug to 'magazine/...
0
votes
1answer
78 views

Display taxonomy loop using custom field data

Just learning PHP. Wondering what I'm doing wrong here. The aim is: if custom field in taxonomy term (in "shows" taxonomy) has data, show posts loop of taxonomy term in a custom post type ("blogs"). ...
27
votes
6answers
17k views

Use register_post_type() to modify an existing post type

There are lots of situations where a theme or plugin registers a post type and you want to modify it. There is of course add_post_type_support() and remove_post_type_support(), but those don't give ...
0
votes
0answers
31 views

How to create custom post type selection to nav menu

I added a custom post type in my navigation menu. with this code register_post_type( 'post_type_name', array( 'exclude_from_search' => false, 'label' ...
3
votes
2answers
111 views

What is the difference between “post” and “page” in WordPress?

I understood that both post and page are coming under the same post-type but I noticed that both are showing the almost same layout and behavior. could anyone explain in short words? Advance Thanks
0
votes
2answers
77 views

determine whether content is of type Page or a Post and display accordingly

I'm looking for a way to open every/any link to a blog post in a lightbox/modal globally and without having to any extra classes or rel attribute to the link element. I know I can access this info ...
1
vote
1answer
111 views

How can I pick a single post from the latest 3?

I'm looking to display a single featured post from my latest 3 posts at random. I've managed to get it up and running picking any post at random just fine, but I want to filter it down to only the ...
0
votes
0answers
16 views

Load custom post template

I'm pretty new to Wordpress Theme-development, so this might be a beginners-question. I looked everywhere for an answer, but none seems to suit my situation. I have created a custom shop page which ...
0
votes
1answer
390 views

Undefined property: WP_Post_Type::$ID

Using the Query Monitor Plugin - I'm getting this Error Undefined property: WP_Post_Type::$ID for this function: public function add_form_modal() { $button_group = get_post_meta( ...
0
votes
2answers
158 views

Woocommerce - custom post type of checkout page

Is it possible to set custom post type page as a checkout page in woocommerce? I can set only default pages, but I need different post type.
9
votes
2answers
9k views

How do i know the current post type when on post.php in admin?

Im trying to do something with an admin_init hook if - and only if - the user is editing a post (post.php) with post type "event". My problem is that, even though wordpress points to a global variable ...
0
votes
1answer
66 views

Setup database structure with books, authors, languages etc. for publishing house [closed]

It was kind of hard to find a good title for my question. What I'm trying to do is setting up a homepage for a publishing company. The website should contain all of the companies books with ...
8
votes
3answers
19k views

Custom post type pagination 404 fix?

Been trying to get this working all day but haven't had any luck... I have a custom post type called 'news' and an archive template (archive-news.php), here I'd like to show 2 posts with pagination, ...
0
votes
1answer
21 views

Is there default meta boxes types that handles types and sanitization?

I've been tasked with my first WordPress project. It's a project that involves custom plugin development. While looking over the documentation for adding custom post types I found the meta boxes ...
0
votes
0answers
110 views

How can I get the Post ID and Post Type within a Must Use Plugin?

I'm trying to get the Post ID and the Post Type inside of my MU Plugin; functions like: get_the_ID() and get_post_type() return false, instead of the desire values. I read that many functions are ...
3
votes
4answers
11k views

Get list of all registered post types slugs

I'd like to get a list (array) of all the post types I registered. Precisely I would like to retrieve their slugs. Could someone help me? thanks!
1
vote
1answer
17 views

What is the meaning of the various post messages?

I'm confused about some of the messages that can appear on a post entry/edit screen in the admin area: $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. 1 ...
0
votes
1answer
323 views

How to check if it's edit.php & post_type is set?

I wanted to use css codes on certain post type with certain post status so i'm looking for a correct conditionals to use. How can i detect this if it's edit.php & post_status = draft& ...
0
votes
1answer
71 views

Pass PHP through redirect and custom fields

I'm trying to construct an easy to use affiliate site, each post-type has a custom field where keywords can be entered per post. ( using advanced custom fields plugin ) Then in a template I call ...
0
votes
1answer
31 views

How to mix 2 kinds of post types

I've got a real estate website. How can I make a connection with property and a client which is an owner of the property? There will be a lot of properties, and sometimes 1 owner will have 2 or more ...
0
votes
1answer
78 views

How to hide specific post type from archive?

Assume there is a post type called profilepost that I wanna hide from all kinds of archive. (but not changing the post status to private) I tried to get all post ID that belongs to this post type. The ...
0
votes
1answer
932 views

post_parent in custom post type

I've two custom post types, type1 and type2 My current workflow of creating contents, from the user perspective a user created posts of type1, i.e. post1, post2, post3 on a particular day our system ...
0
votes
1answer
91 views

Change Custom Post Type to Post + Category

I have a rather difficult problem, I have a news site and I used a custom template with custom post-types for each "category" and now I want to change the template, but I can not change the posts for ...
0
votes
1answer
274 views

Wordpress delete mysql rows with string

So I'm updating the code of an old wordpress plugin(never released), and I want the database to be "clean" before importing new data otherwise data will just add up and i want it clean before every ...
0
votes
1answer
38 views

Conditional based on post meta

I've got this bit of code in my functions.php : // Disable theme single views function fq_disable_single_cpt_views() { $queried_post_type = get_query_var('post_type'); $...
0
votes
2answers
1k views

How to set a default CPT template and create post attribute´s display rules?

I have registered a new post type and made a custom template to display it. According to WP´s latest support for CPT templates, all it takes to make it available for any given CPT is to place this ...
0
votes
0answers
230 views

Shortcode in excerpt

I've a custom post type " Calendarize it ". And i would like to show at the end of the exerpt the custom taxonomy "Price". The price can be display by using this shortcode : [rhc_term taxonomy="prix"]...
0
votes
1answer
204 views

Dynamic pages for linked categories and content

Not new to Stack Exchange (i.e., Stack Overflow), but new to WordPress. I want to understand the power of categories, posts, custom post types, and the ability to generate dynamic content using them. ...
0
votes
1answer
28 views

How can i order my posts by post type?

i have a query post : $args3 = array( 'posts_per_page'=>20, 'post_type'=>array('num1','num2'), 's' => urldecode($command), 'orderby' => 'type', 'order' => 'ASC' ); ...
0
votes
3answers
68 views

Permanent Custom Post Type

How do I add a custom post type to what I'm assuming is a table in WP's underlying database. I.e. I don't want to have this loading on every page and I want to be able to use slug and post-type ...
0
votes
1answer
59 views

post_type not working when tag__in is present?

I noticed that when I have the tag__in argument, the post_type one is ignored. Has anyone noticed this or knows a fix? `$args = array( 'post_type' => 'page', '...
1
vote
2answers
50 views

I don't arrive to do order_by title when i have a conditionnal year in a request

I have a problem with this request with get_posts,when I want to order by title with year, order by doesn't work but when I do it without year, the request works. $args = array( '...
0
votes
0answers
260 views

Custom post type post_type_link gives “page not found” on any other custom post type

I'm trying to edit an existing custom post type for the theme I'm using called "Divi". This custom post type is called a "project". Now I'm trying to change the default slug of: http://example.com/...