Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Custom Post Types extend WordPress to support additional content.
15
votes
Accepted
Custom Post Type Next/Previous Link?
If you need next/previous links for single posts, there is the built in next_post_link function and matching previous_post_link, both of which should probably be used within the loop.
For archives, u …
1
vote
Custom Post Type content isn't shown
You need to register you post type with the has_archive argument to get an archive page at /<post_type_slug>/.
Eg.
<?php
add_action('init', 'wpse70469_register');
function wpse70469_register()
{
…
1
vote
Accepted
Take stored email addresses from custom post type & turn into one string
There are many ways you can do this. For my examples, I'm going to assume you've stored the emails in the post_title field. wp_mail takes a string or array in the to field, so you can do something li …
14
votes
Accepted
How to add "supports" parameter for a Custom Post Type?
Yes, there's a function called add_post_type_support
Hook into init -- late, after the post types have been created -- and add support.
Adding support for excerpts to pages for instance:
<?php
add_ …
46
votes
How to get current get_post_types name?
You'll need the post object somehow, or, alternatively the queried object on post type archives. On a singular page you might do:
$post = get_queried_object();
$postType = get_post_type_object(get_po …
2
votes
Accepted
archive as a page, so that it can be added in the wp_menu_nav
Look for this in the code where you registered the lyrics post type:
'has_archive' => true,
Set 'has_archive' => false. That won't work right away, however. So you need to go in an "refresh" your …
0
votes
Is there any way of not using my_init_method in the following code (that creates a custom po...
Based on your comments to Chip, I think this is probably what you want:
add_action( 'init', array( 'YourSite_Blocks', 'on_load' ) ).
And remove add_action( 'init', 'my_init_method' );
What you wa …
2
votes
Accepted
How does: /index.php?post_type=event&event-date=2011-07-25 work? What if it doesn't work?
You will have to use the rewrite API to get that to work. First you need to register the rewrite rule.
add_action( 'init', 'wpse23712_rewrites' );
function wpse23712_rewrites()
{
add_rewrite_rule …
3
votes
Wordpress if in term*
http://codex.wordpress.org/Function_Reference/has_term
So...
<?php
if ( has_term('products', 'your_custom_taxonomy', $post ) )
{
get_template_part('products');
}
elseif ( has_term( 'downloads …
3
votes
Accepted
How do I display a list showing custom post types nested within a taxonomy?
Okay, so first off, I would rename your video category to something like video_category so it doens't conflict with the built in category.
That said, the easiest way I could think to demonstrate this …
6
votes
Thumbnails on next/previous links in custom post type single.php
The first argument that get_previous_post and get_next_post is $in_same_cat. WordPress is looking for post of the same type in the current posts category. If your custom post type doesn't support th …
1
vote
How do I override the default number of items to be listed on an archive.php page?
You can hook into pre_get_posts and modify the query. Your hooked function will receive a WP_Query object as it's only argument. You can check to see if you're on a the correct post type archive and …
4
votes
How can I display custom post types under multiple views?
What you want is a rewrite endpoint.
You're already familiar with these. WordPress' urls that end with feed are simple a rewrite endpoint, and you can add your own!
add_rewrite_endpoint takes two a …
2
votes
Hide custom post type field from author?
The easiest way to do that would be to check the capabilities with current_user_can before displaying the field.
For instance, the administrator role has the capability manage_options which your newl …
1
vote
Accepted
custom post template ignored after altering permalinks
Custom post types have a different hierarchy than pages or posts.
They'll use single-{{post_type}}.php and fall back to single.php. Post type archives will use archive-{{post_type}}.php and fall back …