Last active
August 29, 2015 14:17
-
-
Save der-lukas/e308672be57ecff69284 to your computer and use it in GitHub Desktop.
Collection of useful functions for Wordpress Just drop in functions.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
if( function_exists('acf_add_options_sub_page') ) | |
{ | |
acf_add_options_sub_page( 'General' ); | |
acf_add_options_sub_page( 'Kontakt Intros' ); | |
} |
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 cc_mime_types($mimes) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'cc_mime_types'); | |
function custom_admin_head() { | |
$css = ''; | |
$css = 'td.media-icon img[src$=".svg"] { width: 100% !important; height: auto !important; }'; | |
echo '<style type="text/css">'.$css.'</style>'; | |
} | |
add_action('admin_head', 'custom_admin_head'); |
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 get_id_by_slug($page_slug) { | |
$page = get_page_by_path($page_slug); | |
if ($page) { | |
return $page->ID; | |
} else { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment