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
<div id="fb-catcher"></div> | |
<script> | |
if (document.documentElement.clientWidth >= 600) { | |
document.getElementById('fb-catcher').innerHTML='<div id="fb-root"></div>'; | |
} | |
(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); js.id = id; |
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 get_string_between($string, $start, $end){ //required for parsing attachment URL's in attachment_image_retrieve | |
$string = " ".$string; | |
$ini = strpos($string,$start); | |
if ($ini == 0) return ""; | |
$ini += strlen($start); | |
$len = strpos($string,$end,$ini) - $ini; | |
return substr($string,$ini,$len); | |
} | |
function attachment_image_retrieve($size = 'thumbnail', $limit = '-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
$value = get_query_var($wp_query->query_vars['taxonomy']); | |
echo get_term_by('slug',$value,$wp_query->query_vars['taxonomy']); |
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 all custom post types to the "Right Now" box on the Dashboard | |
add_action( 'right_now_content_table_end' , 'ucc_right_now_content_table_end' ); | |
function ucc_right_now_content_table_end() { | |
$args = array( | |
'public' => true , | |
'_builtin' => false | |
); | |
$output = 'object'; | |
$operator = 'and'; |
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
// stop wordpress from wrapping images in <p> tags | |
function filter_ptags_on_images($content) | |
{ | |
// do a regular expression replace... | |
// find all p tags that have just | |
// <p>maybe some white space<img all stuff up to /> then maybe whitespace </p> | |
// replace it with just the image tag... | |
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); | |
} | |
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
// Corrects the gallery URL attachment that disallows custom URLS | |
// Use get_post_meta( ATTACHMENT_ID_HERE, '_wp_attachment_url', true ) to retrieve | |
function _save_attachment_url($post, $attachment) { | |
if ( isset($attachment['url']) ) | |
update_post_meta( $post['ID'], '_wp_attachment_url', esc_url_raw($attachment['url']) ); | |
return $post; | |
} | |
add_filter('attachment_fields_to_save', '_save_attachment_url', 10, 2); | |
function _replace_attachment_url($form_fields, $post) { |
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
var currentTallest = 0, | |
currentRowStart = 0, | |
rowDivs = new Array(), | |
$el, | |
topPosition = 0; | |
$('.blocks').each(function() { | |
$el = $(this); | |
topPostion = $el.position().top; |
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 | |
$server = "localhost"; | |
$database = "database"; | |
$username = "user"; | |
$password = "password"; | |
$mysqlConnection = mysql_connect($server, $username, $password); | |
if (!$mysqlConnection) | |
{ | |
echo "Please try later."; |
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
// Fix pagination for static homepage with augmented query | |
function modify_query($query) { | |
if($query->is_main_query()) { | |
if (! get_query_var('paged')) { | |
$paged = (get_query_var('page')) ? get_query_var('page') : 1; | |
$query->set('paged',$paged); | |
} | |
} | |
} | |
add_action( 'pre_get_posts', 'modify_query' ); |
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 $image_grabbed = substr_replace(get_post_meta($post->ID,{field_key},true), '-150x150', -4, 0); ?> | |
<?php echo $image_grabbed;?> |
OlderNewer