Problem excluding category from get_next_post
Did you try with: get_adjacent_post ? get_adjacent_post(false, ‘YourID’, false); wp topic: get_adjacent_posts-exclude-category-syntax
Did you try with: get_adjacent_post ? get_adjacent_post(false, ‘YourID’, false); wp topic: get_adjacent_posts-exclude-category-syntax
I’m posting my comment to @MarkKaplun as part of my answer. My point is this, every end user experience a certain thing in a certain way based on his/her own knowledge, experience, usability and personal preference. There can never be a wrong or right answer here. Option one might suite you best, option two might … Read more
You want to use the register_taxonomy_for_object_type function documented here add_action(‘init’,’fix_my_tax’); function fix_my_tax(){ register_taxonomy_for_object_type(‘taxonomy’, ‘post_type’); }
See the codex re Meta Query. For example, this would get all posts at least a day old: $date = date(‘Y-m-d H:i:s’,strtotime(“-1 days”)); // 1 day ago meta_query’ => array( array( ‘key’ => ‘name of your key’, ‘value’ => $date, ‘compare’ => ‘<=’, ‘type’ => ‘DATETIME’, ), )
There seems to be a problem with the custom post type feed support when has_archive is false. Check for example these tickets: #16415 Don’t require CPTs to have archives in order to have feeds #24867 Feeds for custom posts type can not be set independently of has_archive and supports => comments So regarding the native … Read more
To be really honest here, that is a useless parameter when used with custom taxonomies, as custom taxonomies are already registed to a custom post type when they are registered. Using the taxonomies parameter, you are re-registering a custom taxonomy to the custom post type As stated by the codex, the taxonomies parameter is used … Read more
You must add this part to function.php: add_action( ‘pre_get_posts’, ‘example_func’, 1 ); function example_func( $query ) { if ( is_admin() && $query->is_main_query() ) { $query->set( ‘order’ , ‘DESC’ ); } return $query; }
This is basic PHP. Just a note before I continue, never ever globalize variables. WordPress has already done quite a crappy job regarding this. Globalization is evil, because anyone and anything, knowingly or unknowingly can change a global variable. This makes globals a nightmare to debug. So in short, NEVER EVER globalize. Whenever you need … Read more
Passing non-private/non-protected/non-sensitive values through the URL is quite widely used and a more reliable way of passing values from one page to another. The reason for this is, $_SERVER[‘HTTP_REFERER’] is totally unreliable and can never be trusted. It can also, in many case be an empty value. Check the two following posts for more details … Read more
According to this blogpost you just need to add the following code to your themes functions.php or in a plugin: /* Add CPTs to author archives */ function custom_post_author_archive($query) { if ($query->is_author) $query->set( ‘post_type’, array(‘custom_type’, ‘post’) ); remove_action( ‘pre_get_posts’, ‘custom_post_author_archive’ ); } add_action(‘pre_get_posts’, ‘custom_post_author_archive’);