This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function email_feed_post_limit( $limit, $query ) { | |
if ( ! is_admin() && $query->is_feed() && isset( $_GET['email'] ) && $_GET['email'] ) { | |
return 'LIMIT 0, 10'; | |
} | |
return $limit; | |
} | |
add_filter( 'post_limits', 'email_feed_post_limit', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode('location_date','location_date_sc') | |
function location_date_sc( $atts, $content ){ | |
extract( shortcode_atts( array( | |
'post_id' => get_the_id(), | |
), $atts, 'location_date' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getInternetExplorerVersion() | |
{ | |
var rv = -1; | |
if (navigator.appName == 'Microsoft Internet Explorer') | |
{ | |
var ua = navigator.userAgent; | |
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) | |
rv = parseFloat( RegExp.$1 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_get_field( $key, $id = null ){ | |
if( !$id ) | |
$id = get_the_id(); | |
if( function_exists('get_field') ){ | |
return get_field( $key, $id ); | |
}else{ | |
return get_post_meta( $id, $key, true ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_urlredirect', 10, 3 ); | |
function salesforce_w2l_field_urlredirect( $val, $field, $form ){ | |
$postid = get_the_id(); | |
// Target a specific field on all forms | |
if( $field == 'retURL' ){ | |
if( $field == 'retURL' && $postid == '671' ) { | |
$URL = 'http://www.mycompany.com/thank-you?option=1' ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pht_write_file( $id, $post) { | |
$upload_dir = wp_upload_dir(); | |
$file = $upload_dir['basedir']."/publication-hub-tools/test.xml"; | |
$content = $post->post_content; | |
// convert $content to XML... | |
file_put_contents( $file, $content ); | |
} | |
add_action( 'publish_post', 'pht_write_file', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'salesforce_w2l_cc_admin_from_name', 'yourprefix_salesforce_w2l_cc_admin_from_name' ); | |
function yourprefix_salesforce_w2l_cc_admin_from_name( $name ){ | |
// change to the field names you want to use if not using the built in fields | |
$field_names = array( 'first_name', 'last_name'); | |
$user_name_pieces = array(); | |
foreach( $field_names as $field_name ){ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpdc_count_post_meta( $post_id ){ | |
global $wpdb; | |
$sql = $wpdb->prepare( 'SELECT COUNT( meta_id ) FROM '.$wpdb->postmeta.' WHERE `post_id` = %d', $post_id ); | |
$post_meta_count = $wpdb->get_var( $sql ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('oembed_fetch_url','ch_add_vimeo_args',10,3); | |
function ch_add_vimeo_args($provider, $url, $args) { | |
if ( strpos($provider, '//vimeo.com/') !== false ) { | |
$args = array( | |
'title' => 0, | |
'byline' => 0, | |
'portrait' => 0, | |
'badge' => 0 | |
); |