This is a work in progress. ... Markdown ref: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
Excellent ref:
Very complete: Sublime Text 2 Keyboard Shortcuts Cheat Sheet (Win, OS X and Linux):
<?php | |
// we can only use this Widget if the plugin is active | |
if( class_exists( 'WidgetImageField' ) ) | |
add_action( 'widgets_init', create_function( '', "register_widget( 'ITI_Widget_Image_OTM' );" ) ); | |
class ITI_Widget_Image_OTM extends WP_Widget | |
{ | |
var $image_field = 'image'; // the image field ID |
<?php | |
function output_file($file, $name, $mime_type='') | |
{ | |
/* | |
This function takes a path to a file to output ($file), | |
the filename that the browser will see ($name) and | |
the MIME type of the file ($mime_type, optional). | |
If you want to do something on download abort/finish, |
function my_load_meta() { | |
$script = '/js/script.js'; | |
wp_enqueue_script( 'my-tools', get_template_directory_uri().$script, null, my_version_hash($script) ); | |
$stylesheet = '/style.css'; | |
wp_enqueue_style( 'my-style', get_template_directory_uri().$stylesheet, null, my_version_hash($stylesheet) ); | |
} | |
add_action('wp_enqueue_scripts', 'my_load_meta'); | |
// Create a hash of the file and pass it back for caching purposes | |
function my_version_hash($file) { |
<script> | |
document.write('<script src=/js/vendor/' | |
+ ('__proto__' in {} ? 'zepto' : 'jquery') | |
+ '.js><\/script>'); | |
</script> | |
<script src="/js/foundation.min.js"></script> | |
<script> | |
$(document).foundation(); | |
</script> |
This is a work in progress. ... Markdown ref: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
Excellent ref:
Very complete: Sublime Text 2 Keyboard Shortcuts Cheat Sheet (Win, OS X and Linux):
@font-face { | |
font-family: 'MyFontFamily'; | |
src: url('myfont-webfont.eot?') format('embedded-opentype'); | |
} | |
@font-face { | |
font-family: 'MyFontFamily'; | |
url(data:font/truetype;charset=utf-8;base64,BASE64_ENCODED_DATA_HERE) format('truetype'), | |
url(data:font/woff;charset=utf-8;base64,BASE64_ENCODED_DATA_HERE) format('woff'), | |
url('myfont-webfont.svg#svgFontName') format('svg'); |
<?php | |
// Reposition Genesis Comment Form | |
add_action( 'genesis_before_comments' , 'wps_post_type_check' ); | |
function wps_post_type_check () { | |
if ( is_single() ) { | |
if ( have_comments() ) { | |
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' ); | |
add_action( 'genesis_list_comments', 'genesis_do_comment_form' , 5 ); |
<?php | |
/** | |
* Conditionally force layout in Genesis Framework | |
*/ | |
function cc_layout_logic() { | |
/** | |
* Genesis layout helper functions. | |
* __genesis_return_content_sidebar | |
* __genesis_return_sidebar_content |
add_action( 'tgmpa_register', 'register_required_plugins' ); | |
// This function is called from the above hook | |
function register_required_plugins() | |
{ | |
// The plugins array allows us to define multiple plugins we want to include. | |
// The commented out example shows how we can include and activation a bundled | |
// plugin zip file in our theme. | |
$plugins = array( | |
/* array( |
<?php | |
/* | |
export.php - a script for outputting post type, title and URL in CSV format. | |
All commas are also stripped from titles in order to keep the CSV format (for HootSuite import) versus keeping the titles as is. | |
*/ | |
include "wp-load.php"; | |
$posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish'); |