designerdb
Forum Replies Created
-
Forum: Plugins
In reply to: Woocommerce "Products on sale" always shows same 3 itemsI just needed to remove the filter.
add_filter( 'posts_clauses', array( $woocommerce->query, 'order_by_rating_post_clauses' ) );The end!
Forum: Plugins
In reply to: Woocommerce "Products on sale" always shows same 3 itemsDid some more digging, and realized this query earlier on the page is causing a conflict by asking to sort by rating. I’m not sure how to have both queries present without interference.
<?php //Load 3 highest rated products add_filter( 'posts_clauses', array( $woocommerce->query, 'order_by_rating_post_clauses' ) ); $args = array( 'post_type' => 'product', 'posts_per_page' => '3', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_visibility', 'value' => array( 'catalog', 'visible' ), 'compare' => 'IN' ))); $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); $query_args['meta_query'][] = $woocommerce->query->visibility_meta_query(); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="products-list"> <a href="<?php echo esc_url( get_permalink( $loop->post->ID ) ); ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>"> <?php the_post_thumbnail('product_sm_thumb'); ?> <h3><?php if ( $loop->post->post_title ) echo get_the_title( $loop->post->ID ); else echo $loop->post->ID; ?></h3> <?php echo $product->get_rating_html(); ?> <?php echo $product->get_price_html(); ?> </a> </div> <?php endwhile; wp_reset_query(); // Remember to reset ?>Forum: Plugins
In reply to: Woocommerce "Products on sale" always shows same 3 itemsHave simplified, and here’s the whole shebang
<?php //Load 3 sale products $args = array( 'post_type' => 'product', 'posts_per_page' => 4, 'post_status' => 'publish', 'perm' => 'readable', 'no_found_rows' => 1, 'orderby' => 'date', 'order' => 'DESC', 'post__in'=> array_merge( array( 0 ), wc_get_product_ids_on_sale()) ); $loop = new WP_Query( $args ); if ($loop->have_posts()): while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="products-list"> <a href="<?php echo esc_url( get_permalink( $loop->post->ID ) ); ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>"> <?php the_post_thumbnail('product_sm_thumb'); ?> <h3><?php if ( $loop->post->post_title ) echo get_the_title( $loop->post->ID ); else echo $loop->post->ID; ?></h3> <?php echo $product->get_rating_html(); ?> <?php echo $product->get_price_html(); ?> </a> </div> <?php endwhile; else : print '<p class="noproducts">No products found.</p>'; endif; wp_reset_query(); // Remember to reset ?>I also tried cat => 57 which includes the items I actually want to show up here, but attempting to use categories at all results in no posts found.
Forum: Fixing WordPress
In reply to: add visible "edit profile" link on current user's author pageWorks perfectly!
Forum: Fixing WordPress
In reply to: Typoed somewhere on membeformlogicShould that be different from
do_action(‘wp_insert_post’, ‘wp_insert_post’);
?
Forum: Fixing WordPress
In reply to: Typoed somewhere on membeformlogicWhen I hit submit, nothing happens. The information is not submitted, an error is not listed, and “Successfully posted!” doesn’t print either.
Forum: Fixing WordPress
In reply to: Tag.php … what am I doing wrong?This modified version of the code seems to work: https://core.trac.wordpress.org/ticket/19471#comment:9
Forum: Fixing WordPress
In reply to: Tag.php … what am I doing wrong?Looks like it has to do with a “bug” in WordPress not showing tag archives of custom post types. I confirmed this by adding the tag “short film” to a regular post type post, and it appeared in the tag archive. You can see that tagging a normal post works: http://www.digitalbolex.com/tag/short-film/
Most fixes recommend adding this to the functions.php
function post_type_tags_fix($request) { if ( isset($request['tag']) && !isset($request['post_type']) ) $request['post_type'] = 'any'; return $request; } add_filter('request', 'post_type_tags_fix');however adding that into my functions.php in place of the previous code doesn’t seem to fix the tag issue (although it does fix the incorrect display of the header/footer!)
Forum: Fixing WordPress
In reply to: Tag.php … what am I doing wrong?Quickly:
– all of the posts are actually tagged. Oddly, tags WORKED prior to my last WP upgrade.
– http://www.digitalbolex.com/videos/unexpected-farewell/ is tagged short film, festival selection, slamdance 2015, watch onlineYou are right on the money with the pre_get_posts causing the issue… looks like my webmaster left a reminder to fix the issue, but never actually fixed it! Found this nugget in my functions:
//Custom Post Types Category/Tag Fix THIS IS CAUSING CAT/TAG ARCHIVE PAGE BUG
add_filter(‘pre_get_posts’, ‘query_post_type’);
function query_post_type($query) {
if(is_category() || is_tag() || $query->is_search) {
$post_type = get_query_var(‘post_type’);
if($post_type)
$post_type = $post_type;
else
$post_type = array(‘post’,’videos’, ‘galleries’, ‘products’, ‘nav_menu_item’); // add your custom post type(s). Keep nav_menu_items or menus will break on cat/tag pages
$query->set(‘post_type’,$post_type);
return $query;
}
}Forum: Fixing WordPress
In reply to: Tag.php … what am I doing wrong?Here is a page with tags/a tag cloud:
http://www.digitalbolex.com/videos
In digging deeper, I see this template is based on twentyeleven and not necessarily updated (that presents its own problems…). Twentyeleven does have a tag.php, so I replaced it with the twentyeleven version, but I am still stuck with “nothing found”
I know the tag page is being read as I changed the default “nothing found” text and that reflects on the site.
Forum: Fixing WordPress
In reply to: Tag.php … what am I doing wrong?I understand that is not a search page, I posted that page as an example of how archives typically default on my page.
I am using this template:
https://github.com/WordPress/WordPress/blob/master/wp-content/themes/twentyfourteen/tag.phpDo you see anything missing?