test if something is a post or a taxonomy
test if something is a post or a taxonomy
test if something is a post or a taxonomy
There are 2 points of attack to cover when you are adding custom post type rewrite rules: Rewrite rules This happens when the rewrite rules are being generated in wp-includes/rewrite.php in WP_Rewrite::rewrite_rules(). WordPress allows you to filter the rewrite rules for specific elements like posts, pages and various types of archive. Where you see posttype_rewrite_rules … Read more
Well you can add … ‘supports’ => array(‘title’,’editor’, ‘thumbnail’, ‘custom-fields’), … You don’t need to create anything beforehand, you can define the two fields latitude and longitude when adding a new post.
The orderby argument is limited by what is possible in MySQL, and it’s not good at natural alphanumeric sorting like you describe. Possible options include: Rewriting the values with leading zeros, e.g. “CA05” Creating a separate “Sort Order” column that just stores an integer, and ordering by that. Separating the letters and numbers into two … Read more
You could use the template_include hook to load a specific template for your taxonomy. You would need to change out any instances of my-taxonomy with your specific custom taxonomy and switch out the brand-subcategories.php with whatever your template name is. /** * Force Taxonomy Subcategories to new template * * @param String $template – Expected … Read more
The third line of your code specifies the page post type by checking if is_page(). You can change that to is_singular(‘your-post-type’) so that it runs, then in your call to wp_list_pages() you also need to add a post_type argument so that that part of the code knows what to look for. So, to have this … Read more
Display title of custom post type dynamically
If you’re doing something in the wp_insert_comment hook, then you should use the 2nd argument, $comment_object, if you want to know anything about the post the comment was for. $comment_object is a WP_Comment object that has a $comment_post_ID property that has the ID of the post the comments is for. You can use that to … Read more
add the ‘date_query’ parameter to your query and include the current year. $args = array( ‘post_type’ => ‘news’, ‘posts_per_page’ => 5, ‘post_status’ => ‘publish’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘week’, ‘field’ => ‘slug’, ‘terms’ => date(“W”, strtotime(“this week”)), ) ), ‘date_query’ => array( array( ‘year’ => date(“Y”) ) ) );
1: Switch hosts For this much content, you need a more powerful server. A shared server is unlikely to hold up with this much information in the database, so you need to look into a VPN, dedicated server, or possibly even a load-balanced setup. That partly also depends on how much traffic you are getting … Read more