404 Error on Activate / Deactivate Plugin

For anyone running into a similar problem, it came down to a plugin conflict; in my case Capability Manager Enhanced and Access which is part of the Toolset plugin. Unfortunately no error_log of /var/log/httpd log files were generated as it was an internal permissions conflict within WordPress. If you find yourself in this situation, simply … Read more

Woocommerce custom emails without header and footer

Seems I’ve managed to find the solution. $mailer = $woocommerce->mailer(); must be called before the Get mail template function send_activation_link() { global $woocommerce; //My other code here…. $mailer = $woocommerce->mailer(); ob_start(); // Get mail template woocommerce_get_template(’emails/customer-reset-password-link.php’, array( ‘user_login’ => $user_login, ‘blogname’ => $blogname, ’email_heading’ => $email_heading, ‘key’ => $key )); // Get contents $message = … Read more

Add htmlentities and/or shortcode into data-attributes

the_field echoes the output while htmlentities() expects the value to be returned. Try get_field instead: data-img=”<?php echo htmlentities(get_field(‘portfolio_galleries’)); ?>” UPDATE: Instead of adding this huge chunk of html for the slider to the data-attribute just add it after your image: <img src=”https://wordpress.stackexchange.com/questions/93587/<?php echo $large_image ?>” data-title=”<?php echo get_the_title(); ?>” data-description=”<?php the_content();?>” alt=”<?php echo get_the_title(); // … Read more

register_activation_hook with include file [closed]

You have two options either define you register methods as static and then you can avoid instantiating your classes or even calling the MyActivation function ex: File1.php: Class File1 { static function file1_register() { //register some short codes; } static function file1_unregister() { //unregister previous short codes; } } File2.php: Class File2 { static function … Read more

Transient unique names

Transients have practical limitation on key length (45 symbols or something like that), so using dynamic keys tends to come with risk of ending up with keys too long and having it break down. One of common practices is to form unique string (for example combination of plugin name and type of data being saved, … Read more

Dont’ charge customer until product ships – woocommerce [closed]

This is not so much a WooCommerce issue as a payment gateway issue. Paypal distinguishes, for example, between ‘authorization’ and ‘capture’, Worldpay has similar terms (and a different API). E.g. for Paypal see https://cms.paypal.com/es/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_authcapture. In the case of Paypal, check https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_wpp_integrationguide.pdf: Authorization and Capture API operations: DoCapture Capture an authorized payment. DoAuthorization Authorize a payment. … Read more