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.
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.
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 […]
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 […]
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 […]
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 […]
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 […]
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 […]
This is for use with WP e-Commerce plugin. Use this code if you want to display the “SKU” item number on the single product page (in wpsc-single_product.php). The SKU number is not the same as the Product ID number. The Product ID number (which is like the post ID) is assigned automatically by WordPress. The […]
This is for use with WP e-Commerce plugin. Use this code if you want to show the “Product Tags” as links. It works in the single product page container in wpsc-single_product.php. A Caveat to Using Tag Links In WP e-Commerce One drawback is that, as of WP e-Commerce version 3.8.8, it does not support pagination […]
This function removes these fields from the Contact Info section of the WordPress user profile admin page: AIM Yahoo IM Jabber/Google Talk If you want to add fields for users to enter their Facebook profile URL, and their Twitter, and Google Plus, take the following code, and insert it into line 4 in the code […]