| @@ -5,8 +5,12 @@ | ||
| 5 | 5 | * |
| 6 | 6 | * @package automattic/jetpack |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit( 0 ); | |
| 11 | +} | |
| 12 | + | |
| 9 | 13 | /** |
| 10 | 14 | * Add Jetpack extra functionality to Twenty Twenty. |
| 11 | 15 | * |
| 12 | 16 | * See: https://jetpack.com/support/infinite-scroll/ |
| @@ -29,33 +33,8 @@ | ||
| 29 | 33 | 'sidebar-2', |
| 30 | 34 | ), |
| 31 | 35 | ) |
| 32 | 36 | ); |
| 33 | - | |
| 34 | - // Add theme support for Content Options. | |
| 35 | - add_theme_support( | |
| 36 | - 'jetpack-content-options', | |
| 37 | - array( | |
| 38 | - 'post-details' => array( | |
| 39 | - 'stylesheet' => 'twentytwenty-style', | |
| 40 | - 'date' => '.post-date', | |
| 41 | - 'categories' => '.entry-categories', | |
| 42 | - 'tags' => '.post-tags', | |
| 43 | - 'author' => '.post-author', | |
| 44 | - ), | |
| 45 | - 'featured-images' => array( | |
| 46 | - 'archive' => true, | |
| 47 | - 'post' => true, | |
| 48 | - 'page' => true, | |
| 49 | - 'fallback' => false, | |
| 50 | - ), | |
| 51 | - ) | |
| 52 | - ); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * Add theme support for geo-location. | |
| 56 | - */ | |
| 57 | - add_theme_support( 'jetpack-geo-location' ); | |
| 58 | 37 | } |
| 59 | 38 | add_action( 'after_setup_theme', 'twentytwenty_jetpack_setup' ); |
| 60 | 39 | |
| 61 | 40 | /** |
| @@ -78,9 +57,9 @@ | ||
| 78 | 57 | remove_filter( 'the_excerpt', 'sharing_display', 19 ); |
| 79 | 58 | |
| 80 | 59 | // Remove Likes. |
| 81 | 60 | if ( class_exists( 'Jetpack_Likes' ) ) { |
| 82 | - remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); | |
| 61 | + remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30 ); | |
| 83 | 62 | } |
| 84 | 63 | } |
| 85 | 64 | } |
| 86 | 65 | add_action( 'loop_start', 'twentytwenty_no_sharing_on_excerpts' ); |
| @@ -112,10 +91,10 @@ | ||
| 112 | 91 | * or skip it entirely for wpcom. |
| 113 | 92 | */ |
| 114 | 93 | function twentytwenty_enqueue_jetpack_style() { |
| 115 | 94 | $version = Jetpack::is_development_version() |
| 116 | - ? filemtime( JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.css' ) | |
| 117 | - : JETPACK__VERSION; | |
| 95 | + ? filemtime( JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.css' ) | |
| 96 | + : JETPACK__VERSION; | |
| 118 | 97 | |
| 119 | 98 | wp_enqueue_style( 'twentytwenty-jetpack', plugins_url( 'twentytwenty.css', __FILE__ ), array(), $version ); |
| 120 | 99 | wp_style_add_data( 'twentytwenty-jetpack', 'rtl', 'replace' ); |
| 121 | 100 | } |
| @@ -124,33 +103,34 @@ | ||
| 124 | 103 | /** |
| 125 | 104 | * Add inline custom CSS with custom accent color if there is any set. |
| 126 | 105 | */ |
| 127 | 106 | function twentytwenty_infinity_accent_color_css() { |
| 107 | + $color_info = get_theme_mod( 'accent_accessible_colors' ); | |
| 108 | + | |
| 128 | 109 | // Bail early if no custom color was set. |
| 129 | 110 | if ( |
| 130 | 111 | 'custom' !== get_theme_mod( 'accent_hue_active' ) |
| 131 | - || empty( get_theme_mod( 'accent_accessible_colors' ) ) | |
| 112 | + || empty( $color_info ) | |
| 132 | 113 | ) { |
| 133 | 114 | return; |
| 134 | 115 | } |
| 135 | 116 | |
| 136 | - $color_info = get_theme_mod( 'accent_accessible_colors' ); | |
| 137 | 117 | $custom_css = sprintf( |
| 138 | 118 | ' |
| 139 | - .infinite-scroll #site-content #infinite-handle span button, | |
| 140 | - .infinite-scroll #site-content #infinite-handle span button:hover, | |
| 141 | - .infinite-scroll #site-content #infinite-handle span button:focus { | |
| 142 | - background: %1$s; | |
| 143 | - color: %2$s; | |
| 144 | - } | |
| 145 | - #site-content .entry-content div.sharedaddy h3.sd-title, | |
| 146 | - #site-content .entry-content h3.sd-title, | |
| 147 | - #site-content .entry-content #jp-relatedposts h3.jp-relatedposts-headline { | |
| 148 | - color: %3$s; | |
| 149 | - } | |
| 150 | - ', | |
| 119 | + .infinite-scroll #site-content #infinite-handle span button, | |
| 120 | + .infinite-scroll #site-content #infinite-handle span button:hover, | |
| 121 | + .infinite-scroll #site-content #infinite-handle span button:focus { | |
| 122 | + background: %1$s; | |
| 123 | + color: %2$s; | |
| 124 | + } | |
| 125 | + #site-content .entry-content div.sharedaddy h3.sd-title, | |
| 126 | + #site-content .entry-content h3.sd-title, | |
| 127 | + #site-content .entry-content #jp-relatedposts h3.jp-relatedposts-headline { | |
| 128 | + color: %3$s; | |
| 129 | + } | |
| 130 | + ', | |
| 151 | 131 | $color_info['content']['accent'], |
| 152 | - $color_info['content']['background'], | |
| 132 | + $color_info['content']['background'] ?? '#fff', | |
| 153 | 133 | $color_info['content']['secondary'] |
| 154 | 134 | ); |
| 155 | 135 | |
| 156 | 136 | // Add our custom style to the existing Twenty Twenty CSS compat file. |
| @@ -258,15 +238,16 @@ | ||
| 258 | 238 | function twentytwenty_amp_infinite_older_posts() { |
| 259 | 239 | ob_start(); |
| 260 | 240 | ?> |
| 261 | 241 | <div id="infinite-handle" class="read-more-button-wrap"> |
| 262 | - <span> | |
| 263 | - <a href="{{url}}" class="more-link" rel="amphtml"> | |
| 264 | - <span class="faux-button"> | |
| 265 | - <?php esc_html_e( 'Older posts', 'jetpack' ); ?> | |
| 266 | - </span> | |
| 267 | - </a> | |
| 268 | - </span> | |
| 242 | +<span> | |
| 243 | + <a href="{{url}}" class="more-link" rel="amphtml"> | |
| 244 | + <span class="faux-button"> | |
| 245 | + <?php esc_html_e( 'Older posts', 'jetpack' ); ?> | |
| 246 | + </span> | |
| 247 | + </a> | |
| 248 | +</span> | |
| 269 | 249 | </div> |
| 270 | 250 | <?php |
| 271 | 251 | return ob_get_clean(); |
| 272 | 252 | } |
| 253 | + | |