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 | |
| switch ( get_post_type() ){ | |
| case "podcast": | |
| get_post_type(); | |
| ?> | |
| <h3 class="fancy"><?php _e('Featured Podcast');?></h3> | |
| <p class="podcast-published"><?php echo get_podcast_duration($post->ID) . ' ' . get_the_date(); ?></p> | |
| <a href="<?php echo get_the_permalink($post);?>"><h2 class="h3"><?php echo get_the_title($post);?></h2></a> | |
| <p><?php echo get_dynamic_excerpt($post); ?></p> |
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 | |
| public function podcast_adjust_archive( $template ){ | |
| global $wp_query; | |
| if ( $wp_query->query_vars['is_podcast_archive'] == 1 ) { | |
| $new_template = locate_template( array( 'archive-podcast.php' ) ); | |
| if ( '' != $new_template ) { | |
| return $new_template ; | |
| } | |
| } | |
| return $template; |
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 | |
| public function podcast_adjust_queries($query){ | |
| if ( ! is_admin() && is_post_type_archive( 'podcast' ) && $query->is_main_query() ) { | |
| // if options to exclucde | |
| $inc_articles = get_option( 'options_include_audio_articles_in_podcast_archive' ); | |
| if ( $inc_articles ) { | |
| $query->set( 'post_type', array( 'podcast', 'articles' ) ); |
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 | |
| private function define_public_hooks() { | |
| //Query modification | |
| $this->loader->add_filter( 'pre_get_posts', $plugin_public, 'podcast_adjust_queries' ); | |
| $this->loader->add_filter( 'template_include', $plugin_public, 'podcast_adjust_archive' ); | |
| } |
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
| // Class 👎 | |
| class Edit extends Component { | |
| } | |
| // Functional Components 👍 | |
| const Edit = ( props ) => { | |
| } |
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
| //... other imports | |
| import React, { useState, useEffect } from 'react'; | |
| let locked = 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
| const Edit = ( props ) => { | |
| //... other functions | |
| useEffect(() => { | |
| // console.log( items.length ); | |
| if ( items.length == 0 ) { | |
| if ( ! locked ) { |
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 | |
| add_filter('use_block_editor_for_post', '__return_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
| <?php | |
| if ( is_admin() ) { | |
| add_filter( 'use_block_editor_for_post', 'disable_block_for_post_type', 10, 2 ); | |
| }; |
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 | |
| function disable_block_for_post_type( $use_block_editor, $post ) { | |
| if ( 'gutenbergless' === $post->post_type ) { | |
| return false; | |
| }; | |
| return $use_block_editor; | |
| } |