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
// redirect to home after login/logout | |
add_action('wp_logout','go_home'); | |
function go_home(){ | |
wp_redirect( home_url() ); | |
exit(); | |
} | |
add_action('wp_login','go_home_after_login'); | |
function go_home_after_login(){ | |
wp_redirect( home_url() ); |
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
// remove excerpt panel | |
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'post-excerpt' ); | |
Here is an (incomplete) list of panel IDs: | |
taxonomy-panel-category - Category panel. | |
taxonomy-panel-CUSTOM-TAXONOMY-NAME - Custom taxonomy panel. If your taxonomy is topic, then taxonomy-panel-topic works. | |
taxonomy-panel-post_tag - Tags panel | |
featured-image - Featured image panel. | |
post-link - Permalink panel. | |
page-attributes - Page attributes panel. |
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 | |
/** | |
* Because WP does not allow us to set minimum image dimensions on upload we often | |
* use an ACF image. However this means within the dashboard we lack a thumbnail | |
* Here we set the ACF image to be the WP thumbnail. | |
*/ | |
function image_to_thumbnail( $post_id ) { | |
if( get_post_type($post_id) != 'talent' ) { | |
return; // Stop if post-type is not talent | |
} |
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 | |
/** | |
* Remove junk from wordpress, to help wordpress be more wordpress | |
**/ | |
remove_action( 'wp_head', 'wp_resource_hints', 2); | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
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
// --- TESTED WITH WordPress 5.3.2 | |
// --- ADD BELLOW CODE TO function.php | |
//** Enable upload for webp image files */ | |
function webp_upload_mimes($existing_mimes) { | |
$existing_mimes['webp'] = 'image/webp'; | |
return $existing_mimes; | |
} | |
//** Enable preview / thumbnail for webp image files */ |
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
// disable for posts | |
add_filter(‘use_block_editor_for_post’, ‘__return_false’, 10); | |
// disable for post types | |
add_filter(‘use_block_editor_for_post_type’, ‘__return_false’, 10); |
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(wp) { | |
wp.hooks.addFilter( | |
"blocks.registerBlockType", | |
"my-plugin/modify-linkDestination-default", | |
function (settings, name) { | |
if (name === "core/image") { | |
settings.attributes.linkDestination.default = "media"; | |
} else if ( name === "core/gallery" ) { | |
settings.attributes.linkTo.default = "media"; | |
} |
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
// Disable Gutenberg Completely | |
// disable for posts | |
add_filter('use_block_editor_for_post', '__return_false', 10); | |
// disable for post types | |
add_filter('use_block_editor_for_post_type', '__return_false', 10); | |
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 to make the first image of the post as featured image*/ | |
function generate_featured_image() { | |
global $post; | |
if(!has_post_thumbnail($post->ID)) { | |
$attached_image = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1s"); | |
if($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID,$attachment_id); | |
} | |
} |
NewerOlder