This function gets the closest timezone ID based on latitude/longitude coordinates using only PHP. It doesn’t use any other library, webservice, or API. It only uses the PHP DateTimeZone class. This function is here only for archival purposes. You should NOT use this function if you need to get an accurate timezone. Many times, this … Read more →
Archive for “Code Graveyard”
The Code Graveyard is where I lay to rest snippets of code that I don’t use anymore. Some have lost their usefulness due to the evolving nature of the web, while others have been replaced with better code.
UPDATE: Easy Digital Downloads version 2.7 moved the edd-ajax script to the footer. Therefore, this page is no longer necessary. This moves the edd-ajax.js file (from Easy Digital Downloads Plugin) to the footer instead of the head. Please note that there is no guarantee that this will work smoothly on your site. EDD loads it … Read more →
WooCommerce has updated the payment image that they show for PayPal. Their default PayPal image now includes credit card icons, so my code here is no longer necessary, unless you want to use it with the plugin “Paypal Express” as indicated in the comment below. This shows you how to change WooCommerce’s default PayPal icon. … Read more →
For the updated way to do this, see Create Table With PHP in Existing MySQL Database. Create a MySQL database table using only PHP, for an existing database.
The Timezone web service from GeoNames has a little discrepancy that causes big problems for my app. GeoNames Gives Wrong Latitude Degrees for Hamlet, Indiana. See: Hamlet, Indiana latitude degrees according to GeoNames search = 41.5475442 Hamlet, Indiana latitude degrees according to Wikipedia = 41.381667 GeoNames’s incorrect latitude degrees throws my whole app off. I … Read more →
This was my way of localizing jQuery strings: 1. Set a variable for the localized string in PHP 2. Set that as a jQuery var, and send/hack it up to the head inside my wp_enqueue_scripts function right above the line to enqueue the .js script that needs to use the variable. My method, as is … Read more →
See Show WooCommerce Custom Product Attributes Programmatically with functions for an updated way to do this. WooCommerce Product Attributes are registered as a custom taxonomy. So we can simply use get_the_terms. Woo adds a prefix of ‘pa_’ to the name of your custom product attribute. So if you add an attribute called ‘Version’, who’s slug … Read more →
PROBLEM: If you make your Lazyest Gallery (Lazyest Gallery Plugin by Macbrink) only visible to logged-in users, the gallery will display a message like this: “Please log in or register to view the gallery.” But it doesn’t add a link to login, or a login form. To make the Lazyest Gallery more user-friendly for my … Read more →
PROBLEM: In the single slide view, while viewing a single picture in the Lazyest Gallery (“Lazyest Gallery” Plugin by Macbrink), the previous and next buttons overlap the image caption when the caption is too long. The navigation buttons are floated, which accounts for this problem. This is how i got the navigation buttons to clear … Read more →
PURPOSE: Hide the ‘Lazyest Gallery’ menu item from WordPress admin panel Dashboard for everyone but the administrators. This doesn’t hide the entire ‘Lazyest Gallery’ menu item, but it does remove the “edit Gallery” pages. The result is that your subscribers, contributors, authors, and editors will not be able to edit your gallery, nor delete your … Read more →