Changeset 13843 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
- Timestamp:
- 06/20/2024 10:36:16 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
r13834 r13843 19 19 add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' ); 20 20 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' ); 21 add_filter( 'wporg_block_site_breadcrumbs', __NAMESPACE__ . '\set_site_breadcrumbs' ); 22 add_filter( 'wporg_block_navigation_menus', __NAMESPACE__ . '\add_site_navigation_menus' ); 23 add_filter( 'single_template_hierarchy', __NAMESPACE__ . '\modify_single_template' ); 24 remove_filter( 'template_include', array( 'Sensei_Templates', 'template_loader' ), 10, 1 ); 21 22 add_filter( 'post_thumbnail_html', __NAMESPACE__ . '\set_default_featured_image', 10, 5 ); 23 add_filter( 'sensei_register_post_type_course', function( $args ) { 24 $args['has_archive'] = 'courses'; 25 return $args; 26 } ); 25 27 add_filter( 'sensei_register_post_type_lesson', function( $args ) { 26 28 $args['has_archive'] = 'lessons'; 27 29 return $args; 28 30 } ); 29 add_filter( 'sensei_register_post_type_course', function( $args ) { 30 $args['has_archive'] = 'courses'; 31 return $args; 32 } ); 31 add_filter( 'single_template_hierarchy', __NAMESPACE__ . '\modify_single_template' ); 32 add_filter( 'wporg_block_navigation_menus', __NAMESPACE__ . '\add_site_navigation_menus' ); 33 add_filter( 'wporg_block_site_breadcrumbs', __NAMESPACE__ . '\set_site_breadcrumbs' ); 34 35 remove_filter( 'template_include', array( 'Sensei_Templates', 'template_loader' ), 10, 1 ); 33 36 34 37 /** … … 280 283 return $breadcrumbs; 281 284 } 285 286 /** 287 * Set the default featured image. 288 * 289 * @param string $html The HTML for the featured image. 290 * @param int $post_id The post ID. 291 * @param int $post_thumbnail_id The post thumbnail ID. 292 * @param string|array $size The image size. 293 * @param string|array $attr The image attributes. 294 * @return string The modified HTML for the featured image. 295 */ 296 function set_default_featured_image( $html, $post_id, $post_thumbnail_id, $size, $attr ) { 297 if ( ! $html ) { 298 return '<img src="https://s.w.org/images/learn-thumbnail-fallback.jpg?v=4" alt="" />'; 299 } 300 301 return $html; 302 }
Note:
See TracChangeset
for help on using the changeset viewer.