Skip to content

Instantly share code, notes, and snippets.

View JeppeSigaard's full-sized avatar
💫

Jeppe Sigaard JeppeSigaard

💫
View GitHub Profile
@JeppeSigaard
JeppeSigaard / tomjn_escaping.php
Last active October 2, 2015 19:34
Toms escaping test just got bad asser
<?php
/*
Plugin Name: Toms Escaping test
Plugin URI: http://tomjn.com
Description: Provides a tomjn_esc_test shortcode that lets you test values with escaping
Author: Tom J Nowell
Version: 1.0
Author URI: http://www.tomjn.com/escaping
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
/*
Plugin Name: Filter by parent in admin
Plugin URI: http://www.electricstudio.co.uk
Description: Filter pages in wp-admin by their parent page
Version: 1.4.1
Author: James Irving-Swift (updated by Jeppe Sigaard)
Author URI: http://www.irving-swift.com
License: GPL2
*/
@JeppeSigaard
JeppeSigaard / nicks-thumbnail-excerpt.php
Last active December 14, 2015 08:19
Vis thumbnail sammen med excerpt på arkivsider
<?php
/*
Plugin name: Nick's Thumbnail Excerpt
Description: Viser thumbnails inden excerpt på arkivsider
*/
add_filter('get_the_excerpt','nicks_thumbnail_excerpt');
function nicks_thumbnail_excerpt($output){
<?php
add_filter( 'image_resize_dimensions', 'prefix_thumbnail_upscale', 10, 6 );
function prefix_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);
<?php
/*
Plugin name: WorPress initial setup
Description: Indstiller indstillinger til standardting første gang wordpress initieres
*/
add_action( 'init', function(){
if (!get_option('prfx_setup_has_run')) {
// Sæt options hér, enkeltvis eller loop gennem en array
<?php
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
<?php
/*
Plugin name: Jeppes login logo
Description: tilføj eget logo til loginsiden.
*/
// Hvis ikke indstillet, tilføj custom header theme-support
if (!current_theme_supports('custom-header'){
$args = array(
<?php
function smamo_include_functions_part_if_exists($fetch, $in = false){
if ($in){$fetch = $in . '/' . $fetch;}
$fetch = get_template_directory() . '/' . $fetch . '.php';
if(file_exists($fetch)){include_once $fetch;}
}
function get_functions_part($fetch, $in = false){
if(is_array($fetch)){foreach($fetch as $p){smamo_include_functions_part_if_exists($p,$in);}}
<?php
/*
Plugin name: WP like button arkiv addon
Description: Tilføj like button på arkivsider
*/
add_filter('[INDSÆT PASSENDE FILTER]','jio_do_wp_like_filter');
function jio_do_wp_like_filter($content){
<?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;