Pagination on custom post type not working

Fixed it by changing the page’s name (more so the page’s URL) so that it did not match the post type name, which causes rewrite problems. I also learned that previous_posts_link(); and next_posts_link(); as well as wp_paginate() rely on the query variable being named “$wp_query”, so “$my_query” doesn’t work. Here’s my fixed code: if ( … Read more

Woocommerce Export Orders with Order Item Meta

Vance I can tell you this is not possible with the stock plugin. I had this same issue on my site. My developer had to edit the plugin code so I could get the meta data in the CSV export. I have a site that deals strictly in personalization so this info is vital.

How do I create a page that displays the homepage?

Download the index.php theme file to your local hard drive. Create a copy of the index.php and name it home.php. Upload the home.php theme file to your theme directory. Go to Reading Settings (Settings > Reading) page in the WordPress dashboard. Select the Your latest posts option and click on the Save Changes button. Any … Read more

Modifying previous_posts link to use AJAX

What am I doing wrong here? First, and foremost… I am editing the wp-includes/link-template.php file in WordPress Don’t hack Core files! Especially when there is a filter that should do what you need. add_filter( ‘previous_posts_link_attributes’, function ($clauses) { echo ‘previous_posts_link_attributes’; return ‘test=”attribute”‘; }, 1 ); You could insert your onclick with the filter. However, your … Read more

Add product category to post_class

Untested, but adapting from the Codex example for filtering the post class… basically changing get_the_categories() to get_the_terms and accounting for the name of the Product Category taxonomy. // add category nicenames to post class function product_category_class($classes) { global $post; foreach((get_the_terms($post->ID, ‘product_cat’)) as $term) $classes[] = $term->name; return $classes; } add_filter(‘post_class’, ‘product_category_class’);

post ordering question

Use a custom field named ‘order’ in each post. Remove the field from posts you do not want to display. Then call the WP_Query object to sort the order field numerically (meta_value_num) skipping any values less or equal to 0 (like in the meta_query below). $posts = new WP_Query( array( ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => … Read more