This file contains hidden or 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 op111_wpcf7_main_add_class($output, $tag, $atts, $m) { | |
if ($tag === 'contact-form-7' && $atts['title'] === 'Main') { | |
$output = str_replace( | |
'wpcf7-submit', | |
'wpcf7-submit wpcf7-submit-main', | |
$output | |
); | |
} | |
return $output; |
This file contains hidden or 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
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
if(event.detail.contactFormId == 'wpcf7-f3112-o2') { | |
//put your code here | |
} | |
}, false ); |
This file contains hidden or 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
More info: https://www.ibenic.com/programmatically-change-yoast-seo-open-graph-meta/ | |
/** | |
* Function to add hooks and filter out the Yoast SEO Open Graph Meta Tags | |
*/ | |
function change_yoast_seo_og_meta() { | |
add_filter( 'wpseo_opengraph_title', 'change_title' ); | |
add_filter( 'wpseo_opengraph_desc', 'change_desc' ); | |
add_filter( 'wpseo_opengraph_url', 'change_url' ); | |
add_action( 'wpseo_add_opengraph_images', 'add_images' ); |
This file contains hidden or 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
// Don't disable on dev | |
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { | |
// Disable core update checking | |
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) ); | |
remove_action( 'admin_init', '_maybe_update_core' ); | |
remove_action( 'wp_version_check', 'wp_version_check' ); | |
// Remove the updates menu item | |
function yell_remove_update_menu() { | |
remove_submenu_page( 'index.php', 'update-core.php' ); | |
} |
This file contains hidden or 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
wp_register_script( 'dummy-handle-footer', '', [], '', true ); | |
wp_enqueue_script( 'dummy-handle-footer' ); | |
wp_add_inline_script( 'dummy-handle-footer', 'console.log( "footer" );' ); |
This file contains hidden or 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 | |
// Register REST API endpoints | |
class GenerateWP_Custom_REST_API_Endpoints { | |
/** | |
* Register the routes for the objects of the controller. | |
*/ | |
public static function register_endpoints() { | |
// endpoints will be registered here |
This file contains hidden or 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
/** | |
* Remove type attribute from scripts | |
*/ | |
public function clean_script_tag($input) { | |
if ( ! is_admin() ) { | |
$input = str_replace( "type='text/javascript' ", '', $input ); | |
return str_replace( "'", '"', $input ); | |
} | |
return $input; | |
} |
This file contains hidden or 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
/** | |
* Prevent update notification for plugin | |
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/ | |
* Place in theme functions.php or at bottom of wp-config.php | |
*/ | |
function disable_plugin_updates( $value ) { | |
$pluginsToDisable = [ | |
'plugin-folder/plugin.php', | |
'plugin-folder2/plugin2.php' | |
]; |
This file contains hidden or 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
/** | |
* Clean metaboxes | |
*/ | |
add_action('admin_init', 'mp_set_user_metaboxes'); | |
function mp_set_user_metaboxes($user_id=NULL) { | |
$meta_key['hidden'] = 'metaboxhidden_dashboard'; | |
$meta_value = array( | |
'dashboard_incoming_links', | |
'wpseo-dashboard-overview', | |
'dashboard_activity', |
This file contains hidden or 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( isset($this->data['file']) ) { | |
$allowed_types = array('image/png', 'image/jpg', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xls', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ); | |
if ( in_array($this->data['file']['type'], $allowed_types) ) { | |
//move temp file | |
$upload_dir = wp_upload_dir(); | |
$upload_dir = $upload_dir['path']; |