@@ 237-248 (lines=12) @@ | ||
234 | /* |
|
235 | * Count published testimonials and flush permalinks when first testimonial is published |
|
236 | */ |
|
237 | function flush_rules_on_first_testimonial() { |
|
238 | $testimonials = get_transient( 'jetpack-testimonial-count-cache' ); |
|
239 | ||
240 | if ( false === $testimonials ) { |
|
241 | flush_rewrite_rules(); |
|
242 | $testimonials = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish; |
|
243 | ||
244 | if ( ! empty( $testimonials ) ) { |
|
245 | set_transient( 'jetpack-testimonial-count-cache', $testimonials, HOUR_IN_SECONDS * 12 ); |
|
246 | } |
|
247 | } |
|
248 | } |
|
249 | ||
250 | /* |
|
251 | * Flush permalinks when CPT supported theme is activated |
@@ 208-219 (lines=12) @@ | ||
205 | /* |
|
206 | * Count published projects and flush permalinks when first projects is published |
|
207 | */ |
|
208 | function flush_rules_on_first_project() { |
|
209 | $projects = get_transient( 'jetpack-portfolio-count-cache' ); |
|
210 | ||
211 | if ( false === $projects ) { |
|
212 | flush_rewrite_rules(); |
|
213 | $projects = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish; |
|
214 | ||
215 | if ( ! empty( $projects ) ) { |
|
216 | set_transient( 'jetpack-portfolio-count-cache', $projects, HOUR_IN_SECONDS * 12 ); |
|
217 | } |
|
218 | } |
|
219 | } |
|
220 | ||
221 | /* |
|
222 | * Flush permalinks when CPT supported theme is activated |