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
public function register_custom_post_type() { | |
$labels = array( | |
'name' => 'Wiki Pages', | |
'singular_name' => 'Wiki Page', | |
'menu_name' => 'Wiki Pages', | |
'parent_item_colon' => 'Parent Wiki Page:', | |
'all_items' => 'All Wiki Pages', | |
'view_item' => 'View Wiki Page', | |
'add_new_item' => 'Add New Wiki Page', | |
'add_new' => 'New Wiki Page', |
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 | |
// get_page_by_path called in query.php 2119 ! | |
//remove_action('template_redirect', 'redirect_canonical'); | |
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
// work out if we're doing a letter or parcel delivery | |
// Letter max is 26cm x 36cm x 2cm / 0.5kg | |
// everything larger will be parcel. | |
$max_dimensions = array(2,26,36); | |
if($calculate_product['weight']<=0.5){ | |
$product_dimensions = array($calculate_product['length'],$calculate_product['width'],$calculate_product['height']); | |
sort($product_dimensions); | |
$is_letter = ( | |
$product_dimensions[0]<=$max_dimensions[0] && | |
$product_dimensions[1]<=$max_dimensions[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
add_shortcode('bbp-unread-topic-index','dtbaker_bbq_unread_topics'); | |
function dtbaker_bbq_unread_topics(){ | |
if(is_user_logged_in()){ | |
$result = ''; | |
// filter the bbPress query args that are run when [bbp-topic-index] is executed. | |
add_filter('bbp_after_has_topics_parse_args','unread_bbp_after_has_topics_parse_args',3,1); | |
// adjust the generated 'where' SQL to perform a table comparison | |
add_filter('get_meta_sql','dtbaker_get_meta_sql',3,6); | |
// run the built in bbpress shortcode which does everything nicely |
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
<?php | |
/** | |
* Class dtbaker_Widget_Google_Map and dtbaker_Shortcode_Google_Map | |
* Easily create a Google Map on any WordPress post/page (with an insert map button). | |
* Easily create a Google Map in any Widget Area. | |
* Author: [email protected] | |
* Copyright 2014 | |
*/ |
OlderNewer