@@ 160-171 (lines=12) @@ | ||
157 | /* |
|
158 | * Count published projects and flush permalinks when first projects is published |
|
159 | */ |
|
160 | function flush_rules_on_first_project() { |
|
161 | $projects = get_transient( 'jetpack-portfolio-count-cache' ); |
|
162 | ||
163 | if ( false === $projects ) { |
|
164 | flush_rewrite_rules(); |
|
165 | $projects = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish; |
|
166 | ||
167 | if ( ! empty( $projects ) ) { |
|
168 | set_transient( 'jetpack-portfolio-count-cache', $projects, HOUR_IN_SECONDS * 12 ); |
|
169 | } |
|
170 | } |
|
171 | } |
|
172 | ||
173 | /* |
|
174 | * Flush permalinks when CPT supported theme is activated |
@@ 233-244 (lines=12) @@ | ||
230 | /* |
|
231 | * Count published testimonials and flush permalinks when first testimonial is published |
|
232 | */ |
|
233 | function flush_rules_on_first_testimonial() { |
|
234 | $testimonials = get_transient( 'jetpack-testimonial-count-cache' ); |
|
235 | ||
236 | if ( false === $testimonials ) { |
|
237 | flush_rewrite_rules(); |
|
238 | $testimonials = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish; |
|
239 | ||
240 | if ( ! empty( $testimonials ) ) { |
|
241 | set_transient( 'jetpack-testimonial-count-cache', $testimonials, HOUR_IN_SECONDS * 12 ); |
|
242 | } |
|
243 | } |
|
244 | } |
|
245 | ||
246 | /* |
|
247 | * Flush permalinks when CPT supported theme is activated |