Query custom post types
Replace this line: $featuredPosts->query(‘showposts=5&cat=8’); with $featuredPosts->query(array(‘showposts’ =>5, ‘cat’ =>8,’post_type’ => array(‘post’,’events’)));
Replace this line: $featuredPosts->query(‘showposts=5&cat=8’); with $featuredPosts->query(array(‘showposts’ =>5, ‘cat’ =>8,’post_type’ => array(‘post’,’events’)));
Yes, this can be done. Here’s how: get_post_types( array(‘supports’ => array(‘page-attributes’)), ‘names’, ‘OR’); This Trac ticket provides some explanation as to why that last parameter—the ‘OR’—is necessary: http://core.trac.wordpress.org/ticket/17620
Comments have an associated author to them. In a section called “Private Comments” – Query for all comments belonging to the current post where wp_comments->comment_author_email equals the email of the current user. Checkout the wp_comments table. It has 15 or so fields you can filter when displaying comments. EDIT: The code would look something like … Read more
According to the codex for WP_Query, the solution might be to use the post_parent as the id of the top level post. But as there are a whole lotta top level cpts in your case, I think this solution should help you: How to display only top level posts in loop via WP_Query?. Update: <?php … Read more
Figured out that I needed to have the right js dependencies declared. This code now works. Hope it helps someone else with the same problem. Key line array(‘jquery-ui-core’ ,’jquery-ui-datepicker’, ‘jquery-ui-slider’) Full `wp-enqueue’ code: function pbd_events_jquery_datepicker() { wp_enqueue_script( ‘jquery-ui-datepicker’, get_bloginfo(‘template_directory’) . ‘/jquery-ui-datepicker/jquery-ui-1.8.16.custom.min.js’, array(‘jquery’) ); wp_enqueue_script( ‘jquery-ui-timepicker-addon’, get_bloginfo(‘template_directory’) . ‘/jquery-ui-datepicker/jquery-ui-timepicker-addon.js’, array(‘jquery-ui-core’ ,’jquery-ui-datepicker’, ‘jquery-ui-slider’) ); wp_enqueue_script( ‘pbd-datepicker’, get_bloginfo(‘template_directory’) … Read more
Have you tried using get_the_terms()? Quick-and-dirty, from your code example: <?php global $post; $terms = get_the_terms( $post->ID, ‘some-term’ ); foreach ($terms as $category) : ?> <h3>More News From This Category</h3> <ul> <?php $posts = get_posts(‘numberposts=20&category=’. $category->term_id); foreach($posts as $post) : ?> <li><a href=”https://wordpress.stackexchange.com/questions/39455/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endforeach; ?> <li><strong><a href=”<?php echo get_category_link($category->term_id);?>” title=”View … Read more
I think all you should need to do is export from WP as you normally would if you were just transferring the content. Download the resulting XML file, change all <wp:post_type>post</wp:post_type> entries to <wp:post_type>YOUR_CUSTOM_POST_TYPE</wp:post_type>. This should work, assuming your Custom Post Type is already registered in the theme.
This is one of the few cases i would prefer using custom database tables since you are talking about lots of records (10,000 – 100,000) and since Custom post types use the posts table which will hold many empty fields in the case you describe. But i guess there is no right or wrong way … Read more
If you’re running WordPress 3.0.1 or later, I believe your problem lies with the ‘post_type_link’ filter declaration and function arguments. When the ‘post_type_link’ filter is applied, it passes the following 4 arguments: apply_filters(‘post_type_link’, $post_link, $post, $leavename, $sample); But your function accepts $post_link and $id. Try the following adjustments: function custom_post_link( $post_link, $post ) { if … Read more
Jigoshop are doing it wrong… Instead of adding a page to the menu, you can add a link, directly to your ‘product’ archive page. You could, just add a custom link that points to the archive page, though – this has its drawbacks… notably if the url ever changes you’ll have to manually update it … Read more