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 | |
/** | |
* Wordpress: Auto set page template for child pages to be the same as parent. | |
*/ | |
function set_child_page_template( $post_id, $post, $update ) { | |
// Check for post type page | |
if( $post->post_type === 'page' ) { | |
// Check if its a child page | |
if( $post->post_parent !== 0 ) { | |
// If its child get the post parent template |
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 | |
/** | |
* Wordpress: WPML & Elementor fix for elementor library translations (Header etc..). | |
*/ | |
function wpml_elementor_library( $theme_template_id ) { | |
return apply_filters( 'wpml_object_id', $theme_template_id, 'elementor_library', true ); | |
} | |
add_filter('elementor/theme/get_location_templates/template_id', 'wpml_elementor_library', 10, 1); | |
/** |
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 | |
/** | |
* Wordpress: Contact form 7, Add form tag (shortcode) current url example | |
*/ | |
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_current_url' ); | |
function wpcf7_add_form_tag_current_url() { | |
// Add shortcode for the form [current_url] | |
wpcf7_add_form_tag( 'current_url', | |
'wpcf7_current_url_form_tag_handler', | |
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 | |
/** | |
* Wordpress: Filter admin columns and remove yoast seo columns | |
*/ | |
function yoast_seo_remove_columns( $columns ) { | |
/* remove the Yoast SEO columns */ | |
unset( $columns['wpseo-score'] ); | |
unset( $columns['wpseo-title'] ); | |
unset( $columns['wpseo-metadesc'] ); | |
unset( $columns['wpseo-focuskw'] ); |
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 | |
/** | |
* Change options-reading.php static page post type | |
*/ | |
function add_cpt_to_static_home($output, $r, $pages) { | |
if($r['name'] === 'page_on_front' && !isset($r['post_type'])) { | |
$post_type = 'post'; // Set the post type |
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 | |
/** | |
* Filter to add enablejsapi to Elementor youtube video | |
*/ | |
function add_youtube_jsapi($iframe_html, $video_url, $frame_attributes) { | |
if(strpos($video_url, 'youtube') !== false) { | |
$src = esc_attr($frame_attributes['src']); | |
$new_src = esc_attr(add_query_arg(array('enablejsapi' => '1'), $frame_attributes['src'])); | |
$iframe_html = str_replace($src, $new_src, $iframe_html); | |
} |