How to add php plugin code in theme

If you, for some reason, don’t want to use the shortcode ([ratings]), you can always use the_ratings() directly in your template. Make sure you are within the loop so it’ll be able to identify the correct post ID for you. If you want to use it outside the loop, you can pass your ID manually. … Read more

Help on Wp_query to print an term

If you want to output/print the term name look at this within the loop: https://developer.wordpress.org/reference/functions/get_the_terms/ $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ ); You will need to output within the loop similar to this: <?php $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ … Read more

Date of last blog update for specific authors only?

Ok, Paul, So I took a few minutes to figure this out (assuming this is where you’re going with this): Here’s the MySQL query that will give you the latest post date, one user at a time: SELECT post_date FROM wp_posts WHERE post_author = 1066 ORDER BY post_date DESC LIMIT 1 (The number “1066” is … Read more

WooCommerce – Add Shipping class below each product in Shopping Cart page

You can try using a custom function hooked in woocommerce_cart_item_name filter hook, this way: add_filter( ‘woocommerce_cart_item_name’, ‘shipping_class_in_item_name’, 20, 3); function shipping_class_in_item_name( $item_name, $cart_item, $cart_item_key ) { // Only in cart page (remove the line below to allow the display in checkout too) if( ! ( is_cart() || is_checkout() ) ) return $item_name; $product = $cart_item[‘data’]; … Read more

How does WordPress rewrite URLS using its PHP scripts

WordPress can make redirects internally, by wp_redirect() function. It is php code, for it to function, no redirect in Apache (httpd) or Nginx web server is needed. Also, WordPress has own rewrite API, accessible via add_rewrite_rule() and similar functions. This is also php code, which doesn’t require any support from a web server.