This file contains hidden or 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('wp_die_handler', 'get_my_custom_die_handler'); | |
function my_custom_die_handler($message, $title='', $args=array()) { | |
$errorTemplate = get_theme_root().'/'.get_template().'/commenterror.php'; | |
if(!is_admin() && file_exists($errorTemplate)) { | |
$defaults = array( 'response' => 500 ); | |
$r = wp_parse_args($args, $defaults); | |
$have_gettext = function_exists('__'); | |
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) { |
This file contains hidden or 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 | |
/** | |
* [list_searcheable_acf list all the custom fields we want to include in our search query] | |
* @return [array] [list of custom fields] | |
*/ | |
function list_searcheable_acf(){ | |
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF"); | |
return $list_searcheable_acf; | |
} |
This file contains hidden or 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
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language=fra&sensor=false"></script> | |
<script type="text/javascript"> | |
var map; | |
var Markers = {}; | |
var infowindow; | |
var locations = [ | |
[ | |
'Samsung Store Madeleine', | |
'<strong>Samsung Store Madeleine</strong><p>5 Boulevard Malesherbes, 75008 Paris<br>10h – 20h</p>', | |
48.8701925, |
This file contains hidden or 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
// Minimal YouTube & Vimeo embeds | |
function wp_oembed_get( $url, $args = '' ) { | |
if(preg_match("/youtube.com\/watch\?v=([^&]+)/i", $url, $aMatch)){ | |
return '<iframe width="640" height="360" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>'; | |
} | |
if(preg_match("/youtube.com\/watch\?feature=player_embedded&v=([^&]+)/i", $url, $aMatch)){ | |
return '<iframe width="640" height="360" src="http://www.youtube.com/embed/' . $aMatch[1] . '?loop=1&modestbranding=1&rel=0&showinfo=0&autohide=1" frameborder="0" allowfullscreen></iframe>'; | |
} |
This file contains hidden or 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
RewriteBase / | |
RewriteCond %{THE_REQUEST} ^GET\ /wp-admin/ | |
RewriteRule ^wp-admin/(.*)$ manage/$1 [R,L] | |
RewriteRule ^manage(.*)$ wp-admin$1 |
This file contains hidden or 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 convertStamp( unix_timestamp ) { | |
// Create a new JavaScript Date object based on the timestamp | |
// multiplied by 1000 so that the argument is in milliseconds, not seconds. | |
var date = new Date(unix_timestamp*1000); | |
// Hours part from the timestamp | |
var hours = date.getHours(); | |
// Minutes part from the timestamp | |
var minutes = "0" + date.getMinutes(); | |
// Seconds part from the timestamp | |
var seconds = "0" + date.getSeconds(); |
This file contains hidden or 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 | |
/** | |
* @author : Bhaskar K C | |
* generic class for admin columns | |
* Assuming column values are to be stored in post meta | |
* | |
* Columns values can be extended with following usage example | |
* add_action( 'twr_admin_columns', 'callback_function_name', 2, 10 ); | |
* function callback_function_name( $post_type, $column_key ) { // do something here } | |
*/ |
This file contains hidden or 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 | |
/** | |
* @author : Bhaskar K C | |
* generic class for admin posts custom filters **dropdown filter on admin listing pages | |
* Assuming column values are to be stored in post meta | |
*/ | |
if( ! class_exists('TWR_admin_post_filter') ) { | |
class TWR_admin_post_filter { |
This file contains hidden or 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_action('template_redirect', 'twr_custom_template_router', 1); | |
if( ! function_exists( 'twr_custom_template_router' ) ) { | |
/** | |
* Routes predefined list of pages to custom template_redirect | |
*/ | |
function twr_custom_template_router() { | |
$custom_templates_bucket = array( 'schoolsguide', 'school' ); |
This file contains hidden or 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 | |
/** | |
* Copies file from url to current path | |
* @param type $url | |
* @return type file_name on success else bool false | |
*/ | |
function copy_file_from_url( $url ) { | |
if( empty( $url ) ) | |
return false; |