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
$("table").find("td").each(function() { | |
var $this = $(this); | |
$this.html($this.html().replace(/ /g, '')); | |
}); |
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 the_content_filter($content) { | |
// array of custom shortcodes requiring the fix | |
$block = join("|",array("iz_mehr","iz_col", "text_platzhalter")); | |
// opening tag | |
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content); | |
// closing tag | |
$rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep); | |
return $rep; | |
} |
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
/** | |
* How to get last login time in wordpress | |
* https://holisticwp.com/blog/capture-user-last-login-time/705 | |
* | |
*/ | |
add_action('wp_login','wpdb_capture_user_last_login', 10, 2); | |
function wpdb_capture_user_last_login($user_login, $user){ | |
update_user_meta($user->ID, 'last_login', current_time('mysql')); | |
} |
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
/* | |
* Adding Favicons to the WordPress Admin & Login Pages | |
* http://clarknikdelpowell.com/blog/how-to-use-favicons-on-the-wordpress-admin-login-pages/ | |
* | |
*/ | |
function add_favicon() { | |
$favicon_url = get_stylesheet_directory_uri() . '/favicon.ico'; | |
echo "\n"; | |
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />'; | |
echo "\n"; |
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
# .htaccess | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^(.*)$ http://www.NEUE_DOMAIN.de/$1 [R=301,L] |
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
/* | |
* Display image file size in media library | |
* https://wordpress.stackexchange.com/questions/237131/display-image-file-size-in-media-library | |
* | |
*/ | |
function wpse_237131_add_column_file_size( $columns ) { // Create the column | |
$columns['filesize'] = 'Dateigröße'; | |
return $columns; | |
} | |
function wpse_237131_column_file_size( $column_name, $media_item ) { // Display the file size |
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
$user = wp_get_current_user(); | |
$allowed_roles = array('editor', 'administrator', 'author'); | |
<?php if( array_intersect($allowed_roles, $user->roles ) ) { ?> | |
//stuff here for allowed roles | |
<?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
function my_custom_admin_styles() { | |
?> | |
<style type="text/css"> | |
.your-custom-css { | |
height: 300px; | |
overflow: scroll; | |
border: 1px solid #ddd; | |
padding: 15px; | |
} | |
</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
function add_theme_caps() { | |
$role = get_role( 'author' ); | |
$role->add_cap( 'edit_others_posts' ); | |
} | |
add_action( 'admin_init', 'add_theme_caps'); |
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 iz_old_ie_scripts() { | |
if (!is_admin()) { | |
// Make responsive websites and media queries work in IE8 | |
// wp_register_script( 'respond', ( '//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js' ), FALSE, NULL, FALSE ); | |
// wp_script_add_data( 'respond', 'conditional', 'lt IE 9' ); | |
// Support for :nth-child(n), :last-child, etc in IE8 | |
wp_register_script( 'selectivizr', ( '//cdnjs.cloudflare.com/ajax/libs/selectivizr/1.0.2/selectivizr-min.js' ), array('jquery'), NULL, FALSE ); | |
wp_script_add_data( 'selectivizr', 'conditional', 'lt IE 9' ); } | |
} |
NewerOlder