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 sortObjectBy(property) { | |
| var sortOrder = 1; | |
| if(property[0] === "-") { | |
| sortOrder = -1; | |
| property = property.substr(1, property.length - 1); | |
| } | |
| return function (a,b) { | |
| var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; | |
| return result * sortOrder; | |
| } |
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 | |
| /* | |
| * Function / Action to enable choosing private pages as parent pages | |
| */ | |
| function admin_private_parent_metabox($output) | |
| { | |
| global $post; | |
| $args = array( | |
| 'post_type' => $post->post_type, |
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
| //force user login, regardless of post type | |
| //UNLESS public is in the URL | |
| add_action('parse_request', 'rr_login_redirect'); | |
| function rr_login_redirect() { | |
| global $wp; | |
| if(stristr($wp->request,'public/') || stristr($wp->request,'/public')){} | |
| elseif (!is_user_logged_in()) { | |
| auth_redirect(); | |
| } | |
| } |
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 my_enqueue($hook) { | |
| if( 'users.php' != $hook && 'user-meta-manager' != $_GET['page']) | |
| return; | |
| wp_enqueue_script( 'jquery-ui-sortable'); | |
| } | |
| add_action( 'admin_enqueue_scripts', 'my_enqueue' ); |
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('widget_text', 'do_shortcode'); | |
| ?> |
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
| // setup one language for admin and the other for theme | |
| // must be called before load_theme_textdomain() | |
| function set_my_locale($locale) { | |
| $locale = ( is_admin() ) ? "en_US" : "it_IT"; | |
| setlocale(LC_ALL, $local ); | |
| return $locale; | |
| } | |
| add_filter( 'locale', 'set_my_locale' ); |
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 twtreplace($content) { | |
| $twtreplace = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1<a href=\"http://twitter.com/$2\" target=\"_blank\" rel=\"nofollow\">@$2</a>",$content); | |
| return $twtreplace; | |
| } | |
| add_filter('the_content', 'twtreplace'); | |
| add_filter('comment_text', 'twtreplace'); |
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 | |
| class XDOMElement extends DOMElement { | |
| function __construct($name, $value = null, $namespaceURI = null) { | |
| parent::__construct($name, null, $namespaceURI); | |
| } | |
| } | |
| class XDOMDocument extends DOMDocument { |
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
| session_unset(); | |
| session_destroy(); | |
| session_write_close(); | |
| setcookie(session_name(),'',0,'/'); | |
| session_regenerate_id(true); |
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
| add_action('init','disable_default_registration'); | |
| function disable_default_registration(){ | |
| global $pagenow; | |
| if( 'wp-login.php' == $pagenow && $_REQUEST['action'] == 'register') { | |
| $registration_redirect = apply_filters('disable_default_registration_redirect', site_url()); | |
| wp_redirect($registration_redirect); | |
| exit(); | |
| } | |
| } |