Skip to content

Instantly share code, notes, and snippets.

View ekka21's full-sized avatar

Ekkachai Danwanichakul ekka21

View GitHub Profile
@ekka21
ekka21 / select value
Created June 4, 2012 14:33
jQuery: Get a select value
$('#digital_element').change(function() {
alert($(this).val());
});
@ekka21
ekka21 / gist:2794063
Created May 26, 2012 14:01
Wordpress: virtual editor
<?php
//Set the Visual Editor Width Relative to Your Themes Content Width
add_action( 'after_setup_theme', 'wptuts_theme_setup' );
function wptuts_theme_setup() {
set_user_setting( 'dfw_width', 1000 );//In this example the full width will be 1000 pixels.
}
add_action( 'after_setup_theme', 'wptuts_theme_setup' );
function wptuts_theme_setup() {
@ekka21
ekka21 / gist:2793994
Created May 26, 2012 13:40
Wordpress: Custom Queries
//*** Article from http://wp.tutsplus.com/tutorials/creative-coding/writing-custom-queries-in-wordpress/
//The query function needs a string containing the custom query. The returnng value is an integer corresponding //to the number of rows affected/selected, and false when there is an error.
$query = "SELECT COUNT(apple) FROM fruits";
$wpdb->query($query);
//This function gets multiple rows when executing a query. By default the result of the function is an array.
$query = "
SELECT *
@ekka21
ekka21 / gist:2597615
Created May 4, 2012 20:45 — forked from luetkemj/wp-query-ref.php
Wordpress: wp_query
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(