Skip to content

Instantly share code, notes, and snippets.

@pragmatic-web
pragmatic-web / gist:1885364
Created February 22, 2012 14:34
WordPress function to add the TinyMCE WYSIWYG editor to any custom field of type 'Textarea'
// important: note the priority of 99, the js needs to be placed after tinymce loads
// important: note that this assumes you're using http://wordpress.org/extend/plugins/verve-meta-boxes/
// to create the textarea - otherwise change your selector
function admin_add_wysiwyg_custom_field_textarea()
{ ?>
<script type="text/javascript">/* <![CDATA[ */
jQuery(function($){
var i=1;
$('.verve_meta_box_content textarea').each(function(e)
@pragmatic-web
pragmatic-web / wp_include_future_posts.php
Created March 2, 2012 12:56
Add future-dated posts to a WordPress feed
/* Add future posts to RSS feeds */
function include_future_posts($where) {
global $wpdb;
if ( is_feed() ){
// add SQL-syntax to default $where
$where .= " OR $wpdb->posts.post_status = 'future' " ;
}
return $where;
}
add_filter('posts_where','include_future_posts');
@pragmatic-web
pragmatic-web / jquery-watermark-gravityforms-js
Created August 1, 2012 10:08
jQuery Watermark.js Gravity Forms using the field labels
jQuery(document).ready(function() {
// Watermarks
// Watermark on contact form
jQuery('.gfield:not(.watermark-name)').each(function() {
$currLabel = jQuery(this).find('label').text();
jQuery(this).find('input,textarea').watermark($currLabel, {className: 'childtheme-watermark'} );
});
// For complex name
jQuery('.ginput_complex span').each(function() {
$currLabel = jQuery(this).find('label').text();
@pragmatic-web
pragmatic-web / gist:6306792
Created August 22, 2013 12:57
Getting a specific Vimeo thumbnail size via cURL/PHP building on http://www.soapboxdave.com/2010/04/getting-the-vimeo-thumbnail/
function vimeo_thumb_size( $id, $size = 'large' ) {
// Sanitize the variables
$id = esc_attr( $id );
$size = esc_attr( $size );
// Stop if no video ID entered
if ( empty( $id ) )
return 'Error - no video ID specified';
<?php
// http://stackoverflow.com/questions/7952977/php-check-if-url-and-a-file-exists
function is_200($url) {
$options['http'] = array(
'method' => "HEAD",
'ignore_errors' => 1,
'max_redirects' => 0
);
$body = file_get_contents($url, NULL, stream_context_create($options));
.gform_wrapper ul {
.list-unstyled();
}
.gform_wrapper li {
.form-group();
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_required {