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 | |
//-------------------------------------------------------------------------------// | |
// Make ACF WYSIWYG Fields Resizable With HTML Editor Syntax Highlighter Applied // | |
//-------------------------------------------------------------------------------// | |
add_action('admin_head', 'my_custom_styles'); | |
function my_custom_styles() { | |
echo '<style> | |
.CodeMirror { | |
resize: vertical; |
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 | |
//----------------------------// | |
// Customize WP Auto <p> Tags // | |
//----------------------------// | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'custom_wpautop' ); | |
function custom_wpautop($pee, $br = true) { | |
$pre_tags = array(); |
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 | |
//-------------------------------------------------// | |
// Disable Auto <p> Tag Around <img> in ACF Fields // | |
//-------------------------------------------------// | |
function img_unautop($pee) { | |
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '$1', $pee); | |
return $pee; | |
} | |
add_filter( 'acf_the_content', 'img_unautop', 30 ); |
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 | |
//-----------------------// | |
// Disable Visual Editor // | |
//-----------------------// | |
add_filter( 'user_can_richedit', function ( $default ) { | |
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
Fatal error: Uncaught TypeError: Argument 1 passed to WPML_Media_Post_Images_Translation::translate_images_in_post_content() must be an instance of WP_Post, null given, called in /www/htdocs/w0184db4/helmut-kostner.it/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php on line 107 and defined in /www/htdocs/w0184db4/helmut-kostner.it/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php:130 Stack trace: #0 /www/htdocs/w0184db4/helmut-kostner.it/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php(107): WPML_Media_Post_Images_Translation->translate_images_in_post_content(NULL, Object(WPML_Post_Element)) #1 /www/htdocs/w0184db4/helmut-kostner.it/wp-includes/class-wp-hook.php(288): WPML_Media_Post_Images_Translation->translate_images(5) #2 /www/htdocs/w0184db4/helmut-kostner.it/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters |
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 | |
// Removes the Yoast Metabox for Roles other then Admins | |
// Returns true if user has specific role | |
function check_user_role( $role, $user_id = null ) { | |
if ( is_numeric( $user_id ) ) | |
$user = get_userdata( $user_id ); | |
else | |
$user = wp_get_current_user(); | |
if ( empty( $user ) ) | |
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 | |
function remove_unneeded_hreflang( $hreflang_items ){ | |
global $post; | |
global $sitepress; | |
$t_post_id = $sitepress->get_element_trid( $post->ID, 'post_page' ); | |
$translations = $sitepress->get_element_translations($t_post_id, 'post_page', false, true); | |
if(count($translations)==1){ | |
unset($hreflang_items['es']); |
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 | |
// Get repeater value | |
$repeater = get_field('team', [--POST ID--]); | |
// Obtain sub fields | |
foreach ($repeater as $key => $row) { | |
$the_image[$key] = $row['image']; | |
$the_first_name[$key] = $row['first_name']; | |
$the_last_name[$key] = $row['last_name']; | |
} |
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 | |
function webp_upload_mimes( $existing_mimes ) { | |
// add webp to the list of mime types | |
$existing_mimes['webp'] = 'image/webp'; | |
// return the array back to the function with our added mime type | |
return $existing_mimes; | |
} | |
add_filter( 'mime_types', 'webp_upload_mimes' ); |
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 | |
// Set page parents of Custom Post Types - in the Organisation Setting ACF Options page | |
// Based upon Joe Sexton's blog post http://www.webtipblog.com/setting-wordpress-custom-post-type-parent-specific-page/ | |
function mpc_cpt_parent_page( $data, $postarr ) { | |
global $post; | |
// Verify if this is an auto save routine. | |
// If it is, our form has not been submitted - so we don't want to do anything | |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |