Questions tagged [post-type]

The tag has no usage guidance.

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

Get_posts not returning any posts when used with switch_to_blog

I'm attempting to pull in some order information from the "shop_order" post_type. This is on a multisite network, so I'm using switch_to_blog(1). When I set the post type as "post" it works great and ...
0
votes
0answers
21 views

How to enable Attachment post type in Gutenberg editor for blocks?

I would like to make the native Attachment posts to be accessible by various Gutenberg Blocks. (To appear & be selectable in dropdown menus, etc.) Is that possible? The nearest answer i found is ...
2
votes
0answers
7 views

How can I filter block registration based on post-type? (Block alignment settings)

I want to disable the .alignwide and .alignfull block alignment options (remove them from the editor UI) on the 'post' post-type only. I have tried using this block registration filter to modify the '...
0
votes
1answer
27 views

Twillio How To Send SMS for Custom Post Type

Twillio has a tutorial where one assembles a plugin that sends SMS notices when 'post' is published. The issue I face is many 'post' types are published a day and that would generate an annoying ...
0
votes
1answer
17 views

How can I get the content of the current page in my loop while merging post-type

I made a loop which is loading post-type. But while it is loading basic post and post-type, it is not loading the main content of the page. I am searching for a way to load the current page content ...
1
vote
2answers
387 views

Disable block from editor based on post type

I've made a Gutenberg block which is only appropriate to show on hierarchical post types, so I want to disable it from the block inserter for non-hierarchical post types. I thought about how to ...
0
votes
1answer
824 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', ...
2
votes
2answers
661 views

How do I make search results include ONLY pages, no posts?

I'm trying to return only pages in search results. This is working: /?s=term&post_type=post It returns only posts, no pages. But the opposite is not working: /?s=term&post_type=page This ...
1
vote
0answers
19 views

Limit amount of posts made within a custom taxonomy

Is there a way to limit the number of posts that can be created within a custom taxonomy? I have a custom post type called Preferred Agents and a custom taxonomy called Agent Location. I want to be ...
0
votes
1answer
38 views

Quick Draft widget (dashboard.php) using custom post_type

I'm trying to amend the WP dashboard widget 'Quick Draft' to accept a custom post_type avada_portfolio (Avada Fusion Theme) but the page just hangs each submission test. There was a similar question ...
1
vote
0answers
57 views

How to retrieve more posts from a custom post type that are in the same category as the current post

The site I'm working on is using a plugin IssueM that created a custom post type called article, and has a custom taxonomy called issuem_issue_categories that has categories such as boat-profile, ...
0
votes
0answers
23 views

Shortcode is not showing content when placed in editor (post_type = page)

I have created a shortcode, which I want to use in pages. When I place this shortcode in a page (post_type = 'page'), it does now display the content. But if I place the same shortcode in a post (...
1
vote
0answers
24 views

force permalink slug for page vs post_type slug parent

I have setup permalink for post_type "directory" with this slug domain.com/directory/company-name now when I try create page with domain.com/directory is detect as parent of post_type "directory" ...
0
votes
1answer
26 views

Custom query for certain post type OR another post type with a certain category

I want to display posts that are either EITHER Post Type A OR Post Type B but ONLY if they are also in CATEGORY 1 Is that at all posible? How do I built my custom query?
-1
votes
1answer
26 views

How can I get the first post THIS SAME CATEGORY?

How can I get the first post THIS SAME CATEGORY? It's just that now he takes the very first post that is generally in this type, but it is necessary that he takes the first post in the same category ...
0
votes
0answers
29 views

Search in wordpress with keyword and meta key

I want to perform a search in wordpress custom post type like this : search a keyword that exists in the post content in a specific category and much a meta field called city. <form> <...
0
votes
0answers
10 views

echo a list of meta-keys used in specific Custom Field post type

I have a few different post types, and i need to create a filter list for each one. Ideally this would use the 'meta_key' => 'departing_from' created by the customer, So it would only show the ...
3
votes
2answers
274 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
1
vote
0answers
17 views

Incorrect post_type in url of taxonomy term

I have registered a custom post type oa_location with custom menu (using show_in_menu) and a taxonomy called oa_country. These two connected but because our CPT placed in a custom menu, there is a ...
0
votes
1answer
34 views

custom post type single page not found after aotumatic publish By the author's robot

I use a plugin that has a custom post type and when I publish a post it is displayed on a single page but when the post is automatically published using a author's robot plugin, unfortunately the ...
0
votes
1answer
35 views

Distinguish between page and post in function

I'm trying to apply some text to the "Featured Image" box. It works fine for a custom post type, but I can't get a specific piece of text appearing on pages rather than posts. add_filter( '...
0
votes
0answers
24 views

Make category required

I want to prevent a post from submitting if no category is chosen. I don't want them to be automatically in the default category but really force the user to choose a category. I found this question ...
1
vote
2answers
1k views

Custom dashboard menu does not stay open for the custom Taxonomy within it

Short Version: Custom menu with a custom post type that supports a custom taxonomy. The custom post type works, the menu for it works and stays open. The custom taxonomy works, but the sidebar menu ...
0
votes
2answers
4k views

Sort Posts By Custom Field Date?

I have the following code displaying posts from a custom post type. However, I need them displayed in date order from information put in a custom field, can this be done? I try this code :- $course =...
0
votes
0answers
15 views

Add directory slug to the post (but not custom post type) permalink structure [duplicate]

I'm having an issue trying to set up the default posts post type to use the permalink structure of /news/%postname%/ - I've tried editing the permalinks but it throws out my other custom post types. ...
1
vote
1answer
39 views

How to restrict wordpress search to pages and disable products listing search?

I have a requirement where i need to restrict wordpress search to pages listing only and disable products listing . In other words i wanted to replace post type in the search url from 'products' to '...
1
vote
4answers
7k views

Move value from one meta key to another

Migrating question: How would I structure a MySQL query to move the value from one meta_key to another meta_key? eg: I have an old meta_key of "guest_sort" associated with "posts" to "...
0
votes
1answer
79 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
25 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
103 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
39 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
18 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
40 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
55 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
21 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
21 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 ...
1
vote
1answer
20 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
2k 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
1k 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
29 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
2answers
24 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
6k 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
209 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"). ...
29
votes
6answers
20k 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
37 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' ...
0
votes
2answers
83 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
113 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
23 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
1k 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
358 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.