WordPress Shortcode loads at the top

First, declare your variable: $return = ”; Then, throughout the code, concatenate items: $return .= ‘<div class=”sp shadow”><img src=”https://wordpress.stackexchange.com/questions/81864/…”></div>’; $return .= ‘<h3>Videos</h3>’; And finally, return the result: return $return;

Managing large CSS files [closed]

Single HUGE CSS file maintaining is very difficult.But you split that files in multiple then it causes extra http requests which could slow things down. sloution according to me. If you know that your CSS will NEVER change once you’ve built it, Build multiple CSS files in the development stage (for readability),and then manually combine … Read more

Simple WordPress function / plugin to redirect a site

While the plugin might solve your problem you could try something direct with WordPress API: add_action( ‘template_redirect’, ‘wpse_142191_all_redirect’ ); function wpse_142191_all_redirect() { if ( !is_user_logged_in() ) { wp_redirect( ‘http://other-site.com’, 301); exit; //always die or exit after redirect } } Be careful with it,this will redirect the whole site on the home page of other site. … Read more

Disable add to cart button when product is out of stock

Here are some plugins which provide the facilities to hide “Add To Cart” buttons from the shop and single product page in woocommerce, [ https://wordpress.org/plugins/hide-add-to-cart-button/) ] [ https://wordpress.org/plugins/remove-add-to-cart-woocommerce/ ] These plugins will do, 1) Hide Add to Cart button from product single page. 2) Hide Add to Cart button from category page. 3) Hide Add … Read more

Php echo into tag

If you want to wrap an HTML tag around the user display names, you can simply close and open the PHP tags: <div class=”author_sidebar”> <?php if ( is_singular( ‘post’ ) ) { ?> <div class=”foo”><?php echo get_avatar( get_the_author_meta( ‘user_email’ ), 75 ); ?></div> <div class=”bar”><?php echo get_the_author_meta( ‘display_name’ ); ?> <?php } ?> </div>