Snippets: PHP

Date/Time Examples

$today = date('Ymd'); //string $testdate = get_field( 'test_date' ); //string $testerdate = DateTime::createFromFormat( 'Ymd', $testdate ); //convert string to object echo '<p>Today: '.$today.'</p> //string echo '<p>Test [...]
ACF, Date/Time, PHP | Type: PHP

Disable Gutenberg for selected Custom Post Types

function my_disable_gutenberg( $current_status, $post_type ) { // Disabled post types $disabled_post_types = array( 'book', 'movie' ); // Change $can_edit to false for any post types in [...]
CPT, PHP, WP/CP | Type: PHP

Display Featured Image on Listing

How to add featured image to other post types. ADD TO THEME FUNCTIONS // This theme uses post thumbnails add_theme_support( 'post-thumbnails', array( 'plans','listings','news','post' ) ); ON [...]
Images, PHP, WP/CP | Type: PHP

Display the Title for the Posts / Blog Page

You can’t use the standard the_title(); template tag for the page name of the page that displays the blog listing (index.php); that tag will display the [...]
PHP, Template Tags, WP/CP | Type: PHP