Help with SQL commands to interact with a MySQL database
- Mac /usr/local/mysql/bin
- Windows /Program Files/MySQL/MySQL version/bin
- Xampp /xampp/mysql/bin
<?php | |
/** | |
* Class IceCastPlaylist | |
* See https://stackoverflow.com/questions/60502076/how-to-get-icecast-server-songs-history/60798774#60798774 for context | |
* | |
* This class can be used as follows: | |
* global $wpdb | |
* $playlistClass = new IceCastPlaylist($wpdb); | |
* $playlistClass->fetchSongInfo(); |
<?php | |
/** | |
* by Adrian Statescu <[email protected]> | |
* Twitter: @thinkphp | |
* G+ : http://gplus.to/thinkphp | |
* MIT Style License | |
*/ |
add_action ( 'wp_ajax_nopriv_product_quick_view', 'daisy_product_quick_view' ); | |
add_action ( 'wp_ajax_product_quick_view', 'daisy_product_quick_view' ); | |
function daisy_product_quick_view () { | |
$pid = intval($_GET['post_id']); | |
$the_query = new WP_Query(array( | |
'post_type' => 'product', | |
'posts_per_page' => 1, | |
'p' => $pid | |
)); |
<?php | |
/** | |
* When using the WordPress Importer, update existing | |
* posts instead of skipping them. Updates content according | |
* to the import file even if the existing post was updated | |
* more recently. | |
* | |
* To use, drop this file into your /mu-plugins/ folder or | |
* copy this code into your functions.php file. |
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> | |
<!-- It contains information about your site's posts, pages, comments, categories, and other content. --> | |
<!-- You may use this file to transfer that content from one site to another. --> | |
<!-- This file is not intended to serve as a complete backup of your site. --> | |
<!-- To import this information into a WordPress site follow these steps: --> | |
<!-- 1. Log in to that site as an administrator. --> | |
<!-- 2. Go to Tools: Import in the WordPress admin panel. --> | |
<!-- 3. Install the "WordPress" importer from the list. --> |
<?php | |
$taxonomy_objects = get_object_taxonomies( 'cpt', 'objects' ); // <--- change cpt with the custom post type | |
$out = array(); | |
foreach ( $taxonomy_objects as $taxonomy_slug => $taxonomy ){ | |
$terms = get_terms( $taxonomy_slug, 'hide_empty=0' ); | |
if ( !empty( $terms ) ) { | |
$out[] = "<strong>" . $taxonomy->label . "</strong>\n<ul>"; | |
foreach ( $terms as $term ) { | |
$out[] = | |
" <li>" |
Options -MultiViews | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ index.html [QSA,L] |
<?php | |
/** | |
* @link http://jonathonhill.net/2012-05-18/unshorten-urls-with-php-and-curl/ | |
*/ | |
function unshorten_url($url) { | |
$ch = curl_init($url); | |
curl_setopt_array($ch, array( | |
CURLOPT_FOLLOWLOCATION => TRUE, // the magic sauce | |
CURLOPT_RETURNTRANSFER => TRUE, |
.upload-thumb { | |
display: inline-block; | |
width: 120px; | |
height: 120px; | |
overflow: hidden; | |
background: #e2e2e2; | |
border: 1px solid #cdcdcd; | |
line-height: 120px; | |
margin-bottom: 10px; | |
} |