WordPress print all enqueued scripts and handlers

global $wp_scripts; print ‘<!– ‘; var_dump($wp_scripts); print ‘–>’;   Source :¬†https://wordpress.org/ideas/topic/function-to-display-an-array-of-all-enqueued-scriptsstyles

Add a new keypair to AWS linux instance

Thanks to the original author on StackOverflow – Source link below; for this beautiful and clear and concise documentation on adding a new keypair (by creating a new user) on the AWS linux instance. I tried this on a CentOS7 installation and bitnami powered suiteCRM installation and with a few changes, it worked awesomely. Post w/ instructions for bitnami instances will follow soon.

Read more

Override Contact Form 7 Messages and display in Modal or Alert

/* Validation Events for changing response CSS classes */
document.addEventListener( ‘wpcf7invalid’, contactform7replace );
document.addEventListener( ‘wpcf7spam’, contactform7replace );
document.addEventListener( ‘wpcf7mailfailed’, contactform7replace );
document.addEventListener( ‘wpcf7mailsent’, contactform7replace );

function contactform7replace(){
modal = jQuery(‘#Modal’);
msgcontainer = jQuery(“.wpcf7-response-output”);

modal.modal(‘show’);
msgcontainer.css(‘opacity’,‘0’);

modal.find(‘.modal-body’).html( ‘Please wait…’ );
modal.find(‘.modal-footer, .modal-title’).hide();
 
setTimeout(function(){
msg = msgcontainer.html();
msgcontainer.hide();
modal.find(‘.modal-body’).html( msg );
},750);
}

Check WordPress Admin-Bar functionality

if( jQuery(‘#wpadminbar’).length ){ jQuery(‘select-your-fixed-bars’).css(‘padding-top’,’31px’); } // 31px( > M) and 46px (S)

WooCommerce – Placeholders from labels (bookmark)

Link – http://tarikhamilton.com/blog/2016/03/24/create-placeholders-for-woocommerce-fields-from-the-labels-dry/

WordPress | Items of Custom Post Type

<?php /** * Template Name: Page of Products * * Selectable from a dropdown menu on the edit page screen. */ ?> <?php get_header(); ?> <div id=”container”> <div id=”content”> <?php $type = ‘products’; $args=array( ‘post_type’ => $type, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘caller_get_posts’=> 1 $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></p> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?> </div><!– #content –> </div><!– #container –> <?php get_sidebar(); ?> <?php get_footer(); ?>

403 Forbidden – MAMP Pro

So I was working on a wordpress template requiring frequent Sass builds and synced my installation to local MAMP installation. And like always got the 403 Forbidden error and as usual started searching for the solution and quick fix. I am lazy and this seems to happen every time with me. I ended up on http://www.witheringtree.com/2009/09/403-forbidden-using-mamp/ From there I remembered that there is something similar in the Main window of MAMP. So I am just documenting this here for future use,
  • Opened MAMP
  • Select host to edit
  • Clicked on Extended tab on the right
  • Set “AllowOverride” from “All” to “None”
 

What to do if cPanel CSS and layout goes wonky – check cloudflare first!

On my cloudflare activated domain, the cPanel was appearing in a styleless and imageless manner. On searching for a cause for the same, I ended up going through a number of search results and finally found one which seemed to address my issues. Cloudflare was caching up the CSS for the cPanel in addition to the rest of the domain and hence needed to be bypassed for the cPanel. And then everything was fixed. This error is mentioned by them in their docs, but it doesn’t show up in google results untill unless “cloudlfare” and “cPanel” are searched together. Cloudflare docs – https://support.cloudflare.com/hc/en-us/articles/200063289-My-cPanel-won-t-load-or-keeps-logging-me-out-after-enabling-CloudFlare

Read more

Woocommerce Update broke functionality of Cart

Trying to find the reason for the cart not working, I ended up looking through the logs to find out that $woocommerce->show_messages() was causing a fatal error. Googled a little bit and found the following change $woocommerce->show_messages(); to wc_print_notices(); Made the changes and it worked. This problem might affect people who have custom templates with woocommerce support and woocommerce might crash on update.

Equalize Heights

Quick code to Equalize Heights of container elements using jQuery. Iterating through each container element specified, compare the height of the container with the value stored in _maxh variable and after the iteration, we apply the new found height to all the container elements.

Read more