The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
1answer
17 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 ...
0
votes
3answers
2k views

Displaying only the current category in template page

I'm having a problem displaying filtered category list pages. I want to be able to only show the current category, not all of the posts from "my categories". i.e. www...com/mycategories/category-3/ ...
0
votes
1answer
558 views

Taxonomy Category category.php not working

I have created custom post type, taxonomy and categorys. When viewing the category it seems to be using index.php and ignoring the WordPress template hierarchy. Any ideas why category.php, category-{...
13
votes
4answers
6k 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
1answer
57 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 ...
0
votes
1answer
927 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
10 views

Category and post_lists

I´m trying to make a template for a wordpress site where i need to fetch posts form two different categories - two times. (ie.two loops) But seems like the category sort is just working for the ...
0
votes
0answers
30 views

Cutsom post type and Taxonomy page

I have created a custom post type name 'products' and custom taxonomy called 'product_catagory'. The posts are displayed correctly and so is the archive-products.php archive template page I created. ...
1
vote
1answer
55 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 ...
-1
votes
1answer
2k views

Why does 'exclude_from_search' exclude a custom post type from WP_Query?

In WP 3.1, it appears that setting 'exclude_from_search' = TRUE for a custom post type excludes the post type not just from searches on the front-end, but also from any post query using 'post_type' = '...
0
votes
1answer
32 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
32 views

Custom post type single page - always show latest post

I have created custom post type 'products' and template: 'single-products.php' In this template file I have a code: <?php the_post();?> <h1><?php the_title();?></h1> <div ...
2
votes
1answer
2k views

Including post_type = 'wiki' in author archives

For a user with wiki-update permission only, I want to list their wiki articles in the author archive page. Currently, it comes back with "NOT FOUND Apologies, but ...". I am using the Twenty-ten ...
1
vote
1answer
29 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
40 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 ...
0
votes
0answers
18 views

Use custom post_type from a different database

I want to display posts from one site on to a second site. I have succesfully done this: <?php $wpdb = new wpdb( '$DBname', '$Password', '$DBuser', 'localhost' ); $wpdb->set_prefix(...
1
vote
1answer
21 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 ...
0
votes
1answer
674 views

save_post not working with attachments

I've made a Meta Box for Posts and Pages, and while testing added Attachments too. But, curiously, the hook save_post does not fire. $cpts = apply_filters( 'my_filter', array( 'post', 'page' ) ); // ...
0
votes
1answer
38 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, ...
-2
votes
3answers
94 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
20 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'), '...
0
votes
2answers
259 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 ...
3
votes
1answer
586 views

Search through custom post type and custom fields takes 5 minutes

I got strange problem and I'm stuck. I have custom post type with around 15 custom fields. I moved data from old db (not WP) by using wp_insert_post ,update_post_meta and wp_set_object_terms. All ...
1
vote
1answer
114 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
35 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
0answers
37 views

select metabox not saving selection

The code below reside in my plugin.php file, the select box populates fine from the options text area but does not save the chosen value. do not understand why. <p> <?php $...
0
votes
1answer
70 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
0answers
23 views

How to remove custom post type identifier in permalinks? [duplicate]

I've purchased a premium "SEO-fitted" (so I thought) theme, that uses custom post types in the URL. like /cat/ or /item/ But I really need to remove those slugs, and change my URLs so it will be less ...
0
votes
1answer
57 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 ...
1
vote
2answers
473 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
66 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
0answers
21 views

Agent post-type

I try to make custom post-type for my theme which I can add information about agents. Which I found of post-types all are just like ordinary post sharing with title-content-comments... But what I need ...
0
votes
1answer
43 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
22 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)...
1
vote
2answers
2k 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
2answers
1k views

Post Type => Any conundrum

I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has ...
5
votes
4answers
1k views

WP_Query ignores post_type in category view

I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the ...
0
votes
0answers
131 views

Create custom post type just like a page post_type

Here's what I'm trying to achieve: A custom post type with the attributes/properties of a page post_type I'm aware of the supports array which allows page attributes to be used, but this isn't what ...
0
votes
0answers
184 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 ...
1
vote
1answer
1k views

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'oderby' => 'title', 'order'...
0
votes
1answer
16 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
34 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
501 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
40 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
642 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
3answers
681 views

Replace Post-Title with variable

I want to set a custom post-title with a custom-field meta in my Wordpress Theme. The user will add a new post to the post-type. When they do they will only see the "Title", "URL", and "Publish" ...
0
votes
1answer
148 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
287 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
2answers
981 views

Wordpress register_post_type Invalid post type

I am creating my own posts in wordpress however I have hit a little problem and im not sure how to fix it. The below register_post_type creates an Invalid post type error. add_action( 'init', '...
0
votes
1answer
277 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 ...