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
// Get Website Domain TLD | |
function get_site_tld($url){ | |
$host = parse_url($url); | |
preg_match('/(.*?)((\.co)?.[a-z]{2,4})$/i', $host['host'], $m); | |
$ext = isset($m[2]) ? $m[2]: ''; | |
return $ext; // Domain TLD | |
} | |
// For WP just call | |
get_site_tld( get_site_url() ); |
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
# Create symlink | |
ln -s target dest |
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 | |
/** | |
* Allow to open password protected pages with the password in URL | |
* For example: http://examle.com/my-protected-page?access_token=2341223 (GET param: ?access_token=[POST PASSWORD]) | |
* Feel free to replace 'access_token' with any other string | |
* | |
* Author: Max Kostinevich | |
* Author URI: https://maxkostinevich.com | |
*/ |
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
myApp.controller('myCtrl', function( $scope ) { | |
$scope.addNewItem = function ( event ) { | |
var formElement = angular.element(event.target); | |
var itemIndex = formElement[0].itemIndex.value; | |
var optionName = formElement[0].optionName.value; | |
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( 'bbp_get_dynamic_roles', 'my_bbp_custom_role_names'); | |
function my_bbp_custom_role_names(){ | |
return array( | |
// Keymaster | |
bbp_get_keymaster_role() => array( | |
'name' => __( 'Keymaster', 'bbpress' ), | |
'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) |
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 | |
// Loop Markup (lm) | |
// Show 9 posts | |
// add "first" class for each first post in line (3 per line) | |
$lm_ItemsPerLine=3; | |
$lm_CurrentItem=1; | |
$lm_LineClose=''; | |
$lm_LineOpen='<div style="overflow:hidden;">'; | |
query_posts(array ('posts_per_page' =>9) ); | |
if (have_posts()) : while (have_posts()) : the_post(); ?> |
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 | |
// Return allowed upload filesize in MB. | |
function get_upload_max_filesize(){ | |
$upload_max_filesize = (int)(ini_get('upload_max_filesize')); | |
$post_max_size = (int)(ini_get('post_max_size')); | |
$memory_limit = (int)(ini_get('memory_limit')); | |
$allowed_size = min($upload_max_filesize, $post_max_size, $memory_limit); | |
return $allowed_size; | |
} |
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 | |
$protocol = "HTTP/1.0"; | |
if ( "HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"] ) | |
$protocol = "HTTP/1.1"; | |
header( "$protocol 503 Service Unavailable", true, 503 ); | |
header( "Retry-After: Mon, 28 Dec 2015 12:00:00 GMT" ); | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> |
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
var previewImg = $(this); | |
var previewImgSrc=previewImg.attr('src'); | |
var previewImgName=previewImgSrc.match('[^/]*$'); // Get image name |
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( 'enter_title_here', 'my_filter' ); | |
function my_filter( $title ){ | |
$screen = get_current_screen(); | |
if ( 'invoice' == $screen->post_type ){ | |
$title = 'Your placeholder here'; | |
} | |
return $title; | |
} |