Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [post-type]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
1answer
2k views

What are custom_css and customize_changeset used for?

A fresh wordpress install has the following post types: Post (Post Type: 'post') Page (Post Type: 'page') Attachment (Post Type: 'attachment') Revision (Post Type: 'revision') Navigation Menu (Post ...
-1
votes
1answer
63 views

add post type pram to wp shortcode

hello i have this program (show posts with ajax paganition and ajax category filters) and its works fine what i want its add a pram that accept post type in shortcode because i need it to show posts ...
0
votes
0answers
20 views

Post types showing tables…Can I do that?

Hi everyone! I have the design of my web and there's a page that it should look like this. I don't know if this is the good way to do it but I'm trying to make custom types that show like "post", and ...
0
votes
3answers
4k views

single-{post_type}.php not working

I registered a new post type called "events". The posts of this type do show up in the loop but i can't access the single-events.php when i click on a "event" post. Also I can't access the categories ...
0
votes
1answer
34 views

custom post permalink

I want to make single custom post's permalink like this. website.com/cat-1/post-title-1 I have done with one way that is if I keep the post type name, then it shows okay as like this: website.com/...
3
votes
0answers
859 views

Show all parents and children in custom post type in right order

I would like to show all posts from a custom post type on one page with the ordering exactly like in the backend. I get the right ordering with wp_list_pages, but of course without the content. ...
0
votes
1answer
34 views

Adding featured image to post display widget

I have below plugin code that displays custom post types as a recent post widget. I would like this code to also display the summary excerpt of the posts and the featured image of the posts as well. ...
1
vote
1answer
39 views

Understand post type

I am a bit lost, even after searching answers qutie everywhere.. I am creating a theme for Wordpress, and I would like to have three custom post types (gallery, audio and video). So I added the ...
2
votes
1answer
564 views

Resolved - category-slug.php not working after wordpress migration

I have one issue I'm trying to resolve hours ago searching around the web but can't by now. Any Idea or clue is welcome... I'm trying to migrate a WordPress site that use a plugin (CCTM (that have no ...
0
votes
1answer
671 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', ...
3
votes
2answers
2k views

List All Post Types in Admin view using /wp-admin/edit.php?post_type=

I have successfully created a custom post type. I'm trying to construct a URL which points to a combined listing of posts of all post types on the view all posts page in the admin view. I can ...
0
votes
1answer
1k views

how to get random post id by using post type

I need to get a post ID's random manner... Something I tried like this, $args = array( 'post_type' => 'adzones'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->...
2
votes
2answers
909 views

Remove “Comment” column in all post-types

I just want to remove Comment's column in all post-types and in a single function My current function , Have to do each post-type like this : function remove_post_columns($columns) { unset($...
1
vote
1answer
428 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
1answer
75 views

Does only custom post type have post type archive pages?

is_post_type_archive (string|array $post_types = '' ) Is the query for existing post type archive page? Reference: https://developer.wordpress.org/reference/functions/is_post_type_archive/ I search ...
1
vote
1answer
607 views

Search query -> Show all pages except certain template

These are my arguments for the search query: $args = array( 's' =>$s, 'post_type' => array( 'post', 'p24_cases', 'page') ); Using these arguments, the search results will show all pages that ...
0
votes
1answer
561 views

pop-up lighbox with AJAX

I need to create ajax script where user choose a post type and after choose post type post show on a light-box or any thing but without loading. I can't get an idea. Please give me a idea to improve ...
1
vote
1answer
117 views

wp_customize - detect post type to show/hide customizer options

How can I tell the customizer to only load certain customizer options based on the post type that is being previewed? i.e. using: is_woocommerce is_shop is_cart etc. When adding customizer option ...
0
votes
1answer
409 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 ...
1
vote
1answer
105 views

Filter post_type thumbnail in Search result

it's my first question on Stack network so let me know if something wrong in the use of this. I have a theme with these pieces of code: /** * Get the Featured image URL of a post * @global object $...
0
votes
2answers
45 views

How do I add a category to my post_type

I have a section in my dashboard called "services". I have 4 services I have 2 categories for these services: residential and commercial 2 of the 4 services have the category "residential", and the ...
1
vote
1answer
29 views

Should I be using custom post types for this or terms and taxonomies?

So for the past week or so, I've been developing a plugin that lets users manage a restaurant menu. I've learned a lot about the process of making plugins as far as adding custom post types, creating ...
-2
votes
3answers
1k views

How to get only post='product'

I am using this code to search products from a wordpress/woocommerce website. My requirment is URL will be like "http://localhost/wp/?s=D34&post_type=product" While s=D34 is search string. When ...
0
votes
1answer
24 views

Custom post type in theme not appearing

I have a theme on WordPress 4.4 which has this file included in functions.php: <?php function post_types(){ $labels = array( 'name' => __( 'Newsletters'), '...
3
votes
2answers
9k views

How do I implement custom fields without using any plugins?

I am trying to create a member directory and using a custom post type members. I am familiar on how to use the ACF plugin but is there any methods on how to associate a custom field for a specific ...
0
votes
1answer
65 views

Registered Post Type Isn't Showing in Admin Menu

I have a custom function to make posts hierarchical by registering a post type in my functions.php like this: register_post_type( 'post', array( 'hierarchical' => true ) ); After uploading, ...
1
vote
1answer
630 views

get_post_type() in in_array doesn't work for some reason

I am trying to create some function for metaboxes and some reason i can't get get_post_type to work in in_array. Everything else seems to work in testing but in_array nope. This is the function that ...
0
votes
2answers
41 views

Can I change my post type to anything and my site still work?

I'm working on an application using WP as my CMS. I was successfully creating new posts and working with them in my app. But I noticed when visitors went to the website they were being listed in the ...
0
votes
1answer
462 views

WP_Query | 'post_type' doesn't work

I'm new to WP theme development and I've an issue. I've created a custom post type 'portfolio' via CPT UI plug-in. Now I want to create a custom query to show all the posts with the post_type = '...
0
votes
1answer
65 views

How to copy a custom field from the user's CPT to the user's normal posts

Each author has a single post in a CPT. In their CPT post they have a custom field. Each author can also post to a normal post type as much as they like. How can I copy the custom field of the ...
3
votes
2answers
3k views

Get All IDs Of A Post Type Using WP_Query

I am trying to get a list of a custom post type's IDs using WP_Query, but it is returning undesired result, which is a memory leak and stuck browser. Here is the code I use: $the_query = new ...
0
votes
0answers
165 views

do action inside a class is not working

I am trying to create my custom hook and call it from within a metabox class. Here is the pattern: metabox.php -- <?php require("libs.php"); require("test.php"); class metabox() { function ...
0
votes
1answer
74 views

Show post type taxonomy

I'm making a WordPress theme I've copied post-type codes from "AVENUE" theme by "FabThemes". Codes Are these: <?php /* Property Listings*/ function post_type_listings() { register_post_type( ...
1
vote
2answers
234 views

How to retrieve a custom post's capability?

When you register a custom post type, you can specify it's capability: 'capability_type' => 'page', Is there away to retrieve the capability_type within a page (based on the post object provided)?...
0
votes
0answers
226 views

Updated from 3.8 to 4.2 and all post types changed to “post”

My client updated his website from WordPress 3.8.x to 4.2.1 in order to make a plugin verify as working correctly. We were holding off originally to do it and some other plugins all at once so we ...
0
votes
1answer
26 views

Issue attempting a wp_query_posts with tags

Having an issue trying to query the most recent posts using the tag, in this case, trending. I used the following code but I get no results. If I switch out 'tag' to 'post_type' it will work: <?...
0
votes
1answer
44 views

Pulling in Related Posts based on Post Type array

I'm trying to create a Related Posts section on my single.php file and I'm using this as a starting point (http://www.wpbeginner.com/wp-tutorials/how-to-display-related-posts-in-wordpress/) and my ...
0
votes
1answer
3k views

Check If post id exist in custom post type , outside of loop

How can I search in database if id exist in a post type?. I want to search $id=123 in post type 'movies' like this, is this the correct way to do it? $content = get_posts('post_type=movies&id=$...
0
votes
1answer
3k views

get_post_types not working properly in admin

I'm trying to get all post types (custom & built_in) but it's only gives me only built_in ones in admin. I can get all of them in root (5 with builtins included) but in admin, i can only get 3. I ...
0
votes
1answer
407 views

Disable default posts (Posts,Pages,Comments and Media) in wp-admin

I want to disable the default post types for user author in the wp-admin panel of the wordpress and display only custom post types. For that i had got the code given below. function remove_menus(){ ...
1
vote
0answers
1k views

Default 'post' post type archive slug?

I have a wordpress site, which has a front-page.php rendering a custom front page, so that this template will show no matter if WP admin settings is set to static page or show posts. The default ...
0
votes
1answer
961 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 ...
2
votes
1answer
693 views

Custom Post Type causes Page Not Found

I found a basic tutorial online which gave the rundown on how to create a plugin from scratch and sets up a new custom post type. I could not find any basic coupon plugins that accomplished what I ...
0
votes
1answer
50 views

Taxonomy template by post type

I have 2 custom post types that share a taxonomy. The taxonomy template of my taxonomy ( taxonomy-my_tax.php ) will query both custom post types. Is there a way to have a taxonomy template for each ...
0
votes
1answer
184 views

How to define which register_post_status goes to which register_post_type?

New to registering post types but looking at samples, and the codex not helpful here. I am not understanding how the two of these relate? This is just bare bones so someone can explain (the parameter ...
0
votes
1answer
117 views

How to Set Taxonomy Object Description?

I noticed when dealing with Post Type Objects (Using get_post_type_object();) and Taxonomy Objects (Using get_taxonomy();) there's a property called "description". How do you set this description ...
4
votes
2answers
291 views

How do I create a link that will always show the latest post?

If I want to create a link that will always show the latest post how can i do that? Lets say I have three post types and there are three links with posts names (like a nav list) to those post types. ...
2
votes
1answer
721 views

Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy

I have registered a custom post type "Animals" and also two custom taxonomies ("Vertebrate" and "Type") assigned to it, which have their own specific terms, for "Vertebrate" it will be "Mammals" and "...
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
1answer
52 views

Post types translation

I try to translate post types names (Post, Page and Attachment). I have the following code: function create_skip_post_types_box () { $post_types = get_post_types(array('public'=>true), '...