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 | |
// Scheduled posts should update modified date when published | |
function update_modified_date_to_post_date( $post ) { | |
$updated_data = [ | |
'ID' => $post->ID, | |
'post_modified' => $post->post_date, | |
'post_modified_gmt' => $post->post_date_gmt | |
]; | |
wp_update_post( $updated_data ); | |
} |
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 create_manga_categories( $post_id ) { | |
$date = get_field('manga_group')['manga_release_date']; | |
if(get_post_type( $post_id ) == 'manga' && $date) { | |
$date_convert = DateTime::createFromFormat('Ymd', $date); | |
$date_converted = $date_convert->format('F Y'); | |
$date_converted2 = $date_convert->format('F j'); | |
$date_converted3 = $date_convert->format('F-j-Y'); | |
$terms = []; | |
$parent_term_check = get_term_by('name', $date_converted, 'manga_release_date', 'ARRAY_A'); |
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 yoast_og_img( $classes = '', $link = false, $size = 'medium_large' ) { | |
$yoastImg = $yoastImgID = $post_thumb = false; | |
$before = $after = null; | |
$yoastImg = get_post_meta( get_the_ID(), '_yoast_wpseo_opengraph-image', true); | |
$yoastImgID = attachment_url_to_postid( $yoastImg ); | |
$post_thumb = has_post_thumbnail( get_the_ID() ); |
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 | |
// Update post to force show of excerpt | |
function edit_post_show_excerpt() { | |
$user = wp_get_current_user(); | |
$unchecked = get_user_meta( $user->ID, 'metaboxhidden_post', true ); | |
if( !empty( $unchecked ) ){ | |
$key = array_search( 'postexcerpt', $unchecked ); | |
if ( $key !== FALSE ) { | |
array_splice( $unchecked, $key, 1 ); | |
update_user_meta( $user->ID, 'metaboxhidden_post', $unchecked ); |