Redirect specific author posts to another url

First of all… [is_author][1] doesn’t check if given user is author of current post. Straight from Codex: This Conditional Tag checks if an Author archive page is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE. So it won’t help you. Another problem with your code is that you perform … Read more

Lost Your password Hook Not Showing Up

you can use wp_lostpassword_url, or you can directly echo it wherever it’s required just by <br /> <a href= “https://wordpress.stackexchange.com/questions/306570/<?php echo wp_lostpassword_url(); ?>” class=”neolog”><?php _e(‘Not a member?’,’text-domain’); ?> <span><?php _e(‘Request an invitation.’,’text-domain’); ?></span></a> You can visit WordPress Codex for more info.

add product thumbnail to checkout page only and include variation name

You can use the conditional checks to simply build a new return value for the filter. So run the filter once and put all your code in there. Your second example doesn’t really make sense because no matter what, you’re returning $name, can you explain that more? add_filter( ‘woocommerce_cart_item_name’, ‘cart_variation_description’, 20, 3); function wpse306625_cart_variation_description( $name, … Read more

button to toggle css styling / div visibility?

The getElementsByClassName, as the name suggests returns a collection of Elements, meaning an array, so x.style.display won’t work. x[0].style.display would work for the first element that it finds. But since this is WordPress, which by default loads Jquery, you could use: jQuery(‘.cart-multi-step-button-1’).click(function(){ jQuery(‘.cart_totals’).css({ ‘background’: ‘red’, ‘display’: ‘none’, }); }); You could also toggle a class … Read more

Hide empty custom field

I’m assuming what you want is to hide the text when meta is empty. You can put a conditional check for meta before print: add_action( ‘woocommerce_single_product_summary’, ‘also_available_on_ps4’, 38 ); function also_available_on_ps4() { global $product; if ( has_term( ‘ps4-games’, ‘product_cat’ ) ) { if(get_post_meta( get_the_ID(), ‘also_available’, true )){ echo ‘<b>Also available on:</b>’ . get_post_meta( get_the_ID(), ‘also_available’, … Read more

Shortcode displaying outside the div [duplicate]

You could put all the html in a variable and return it $r = “<div id=\”” . $s[‘id’] . “\”…”; if (!empty($s[‘fb’])) { $r .= “<a href=\” . $s[‘fb’] . “…”; } $r .= “title=\”Follow Us On Facebook\” “; $r .= “target=\”_blank\” “; return $r; But every shortcode on your site should do this, for … Read more