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
$possibleTemplates = array( | |
plugin_dir_path( __FILE__ ).'/template_file_name.php', // default template | |
TEMPLATEPATH.'/my_plugin_name/template_file_name.php', // user can override default with this template | |
STYLESHEETPATH.'/my_plugin_name/template_file_name.php', // or user can override default with this template | |
); | |
$tempalteToUse = false; | |
foreach($possibleTemplates as $possibleTemplate){ | |
if(is_readable($possibleTemplate)){ | |
$tempalteToUse = $possibleTemplate; | |
} |
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 | |
// this sample widget will show how many jobs were started in the last 7 days: | |
if(class_exists('module_job',false) && module_job::can_i('view','Jobs')){ | |
$jobs = module_job::get_jobs(array( | |
'date_start_after'=>date('Y-m-d',strtotime('-7 days')) | |
),array('columns'=>'u.job_id')); | |
ob_start(); | |
// icons from http://ionicons.com/ | |
?> |
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
// memory friendly alternative to get_posts( array( 'posts_per_page' => '-1' ) ); | |
$product_page = 1; | |
$product_per_page = 10; | |
$product_query = new WP_Query( array( | |
'posts_per_page' => $product_per_page, | |
'paged' => $product_page, | |
'post_type' => array( 'product', 'product_variation' ), | |
) ); | |
$product_ids = array(); |
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 | |
/** | |
* Class dtbaker_Shortcode_Banner | |
* handles the creation of [boutique_banner] shortcode | |
* adds a button in MCE editor allowing easy creation of shortcode | |
* creates a wordpress view representing this shortcode in the editor | |
* edit/delete button on wp view as well makes for easy shortcode managements. | |
* | |
* separate css is in style.content.css - this is loaded in frontend and also backend with add_editor_style |
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 | |
// upload this signup.php form to your website then change the UCM form action="" to this signup.php file (e.g. <form action="http://yourwebsite.com/signup.php"> ) | |
// CHANGE THIS URL TO YOUR UCM SIGNUP URL | |
$url = "http://yourwebsite.com/ucm/ext.php?m=customer&h=public_signup"; | |
$ch = curl_init($url); | |
// put your code here that does any local processing with form submit data |
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
<!-- put this file in your theme folder --> | |
<div id="googlemap<?php echo $map_id; ?>" class="googlemap" style="height:<?php echo $height; ?>px;"></div> | |
<div class="clear"></div> | |
<?php if ( $enlarge_button ) { ?> | |
<div class="map_buttons"> | |
<a href="http://maps.google.com/maps?q=<?php echo htmlspecialchars( urlencode( $address ) ); ?>" | |
target="_blank"><?php _e( 'Enlarge Map', 'boutique' ); ?></a> | |
</div> |
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 dtbaker_rtl_bracket_hack($content){ | |
if(is_rtl()){ | |
$content = preg_replace('#<p>([^<]+)\)\s*</p>#','<p>$1)‎</p>',$content); | |
$content = preg_replace('#<p>\s*\(([^<]+)</p>#','<p>‎($1</p>',$content); | |
} | |
return $content; | |
} | |
add_filter('the_content','dtbaker_rtl_bracket_hack',100,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 dtbaker_rtl_bracket_js_hack() { | |
?> | |
<script type="text/javascript"> | |
(function($){ | |
$('p:contains(")")').each(function(){ | |
$(this).html($(this).html().replace(/\)(\s*)$/,')‎\1').replace(/^(\s*)\(/,'\1‎(')); | |
}); | |
})(jQuery); | |
</script> | |
<?php |
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
@highdpi: ~"((-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx))"; | |
.double_background(@url){ | |
background: ~"@{url}"; | |
@media @highdpi { | |
background: ~`@{url}.replace(/images\//g, 'images/2x/')`; | |
} | |
} | |
#your_element{ |
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 ( 'wp_tag_cloud', 'tag_cloud_count' ); | |
function tag_cloud_count( $return ) { | |
return preg_replace('#(<a[^>]+\')(\d+)( topics?\'[^>]*>)([^<]*)<#imsU','$1$2$3$4 ($2)<',$return); | |
} |
OlderNewer