Nessuna descrizione

twentytwentyone.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Jetpack Compatibility File
  4. * See: https://jetpack.com/
  5. *
  6. * @package automattic/jetpack
  7. */
  8. /**
  9. * Add Jetpack extra functionality to Twenty Twenty One.
  10. */
  11. function twentytwentyone_jetpack_setup() {
  12. /**
  13. * Add theme support for Infinite Scroll.
  14. */
  15. add_theme_support(
  16. 'infinite-scroll',
  17. array(
  18. 'type' => 'click',
  19. 'container' => 'main',
  20. 'render' => 'twentytwentyone_infinite_scroll_render',
  21. 'footer' => 'main',
  22. )
  23. );
  24. /**
  25. * Add theme support for geo-location.
  26. */
  27. add_theme_support( 'jetpack-geo-location' );
  28. /**
  29. * Add theme support for Content Options.
  30. */
  31. add_theme_support(
  32. 'jetpack-content-options',
  33. array(
  34. 'blog-display' => array( 'content', 'excerpt' ),
  35. 'post-details' => array(
  36. 'stylesheet' => 'twenty-twenty-one-style',
  37. 'date' => '.posted-on',
  38. 'categories' => '.cat-links',
  39. ),
  40. 'featured-images' => array(
  41. 'archive' => true,
  42. 'post' => true,
  43. 'page' => true,
  44. ),
  45. )
  46. );
  47. }
  48. add_action( 'after_setup_theme', 'twentytwentyone_jetpack_setup' );
  49. /**
  50. * Custom render function for Infinite Scroll.
  51. */
  52. function twentytwentyone_infinite_scroll_render() {
  53. while ( have_posts() ) {
  54. the_post();
  55. get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) );
  56. }
  57. }
  58. /**
  59. * Add our compat CSS file for custom styles.
  60. * Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production
  61. * or skip it entirely for wpcom.
  62. */
  63. function twentytwentyone_enqueue_jetpack_style() {
  64. $version = Jetpack::is_development_version()
  65. ? filemtime( JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwentyone.css' )
  66. : JETPACK__VERSION;
  67. wp_enqueue_style( 'twentytwentyone-jetpack', plugins_url( 'twentytwentyone.css', __FILE__ ), array(), $version );
  68. wp_style_add_data( 'twentytwentyone-jetpack', 'rtl', 'replace' );
  69. }
  70. add_action( 'wp_enqueue_scripts', 'twentytwentyone_enqueue_jetpack_style' );