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 | |
add_filter( 'image_resize_dimensions', 'prfx_thumbnail_upscale', 10, 6 ); | |
function prfx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){ | |
if ( !$crop ) return null; | |
$aspect_ratio = $orig_w / $orig_h; | |
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h); | |
$crop_w = round($new_w / $size_ratio); |
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 /* Plugin name: Fjern admin bar */ | |
add_action('init',function(){ | |
if(!is_user_logged_in()){ | |
add_filter( 'show_admin_bar', '__return_false' ); | |
} | |
}); |
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 /* plugin name: Maintenance */ | |
add_action('init', function(){ if( $GLOBALS['pagenow'] !== 'wp-login.php' && !is_user_logged_in() ) { ?> | |
<!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Maintenance title</title> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> |
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 | |
/* | |
Plugin name: Attachment redirect | |
Description: Henvis sider for vedhæftning til forælder hvis den findes, eller forsiden hvis ikke. | |
Version: 0.1 | |
*/ | |
add_action('template_redirect', function(){ | |
global $post; |
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 | |
/* --------------------------------------- */ | |
// Show page templates as states in page list | |
add_filter( 'display_post_states', 'prfx_template_state', 10, 2 ); | |
function prfx_template_state($post_states, $post){ | |
// Fetch array of templates, returning Display name => slug, which is odd, but useful. | |
$templates = get_page_templates(); | |
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 | |
/* | |
Plugin name: Godkend login i 99 dage | |
Description: Forlænger perioden for et login til 99 dage | |
Author: Torben Meldgaard | |
Author URI: http://seatrouting.com | |
*/ | |
add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3); |
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 | |
/* | |
Plugin name: Google analytics tracking kode | |
Description: Indsæt sporingskode til google analytics i hjemmesidens footer | |
*/ | |
add_action('wp_footer',function(){ | |
echo "<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
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 | |
add_image_size('alt-featured-size',752,350,true); // eller hvilke dimensioner du nu ønsker | |
add_filter('post_thumbnail_html',function($html, $post_id, $post_thumbnail_id, $size, $attr){ | |
if ( is_single() || is_singular() || is_page() ){ | |
$html = wp_get_attachment_image( $post_thumbnail_id, 'alt-featured-size', false, $attr ); | |
} | |
return $html; |
NewerOlder