one year. * * @return array The most recently modified posts. */ public function get_recent_posts( string $post_type, int $limit, string $search_filter = '', bool $disable_excluding_old_posts = false ): array { $exclude_older_than_one_year = false; if ( $post_type === 'post' && ! $disable_excluding_old_posts ) { $exclude_older_than_one_year = true; } if ( $this->indexable_helper->should_index_indexables() ) { return $this->get_recently_modified_posts_indexables( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); } return $this->get_recently_modified_posts_wp_query( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); } /** * Returns most recently modified posts of a post type, using indexables. * * @param string $post_type The post type. * @param int $limit The maximum number of posts to return. * @param bool $exclude_older_than_one_year Whether to exclude posts older than one year. * @param string $search_filter Optional. The search filter to apply to the query. * * @return array The most recently modified posts. */ private function get_recently_modified_posts_indexables( string $post_type, int $limit, bool $exclude_older_than_one_year, string $search_filter = '' ): array { $posts = []; $recently_modified_indexables = $this->indexable_repository->get_recently_modified_posts( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); foreach ( $recently_modified_indexables as $indexable ) { $indexable_meta = $this->meta->for_indexable( $indexable ); if ( $indexable_meta->post instanceof WP_Post ) { $posts[] = Content_Type_Entry::from_meta( $indexable_meta ); } } return $posts; } /** * Returns most recently modified posts of a post type, using WP_Query. * * @param string $post_type The post type. * @param int $limit The maximum number of posts to return. * @param bool $exclude_older_than_one_year Whether to exclude posts older than one year. * @param string $search_filter Optional. The search filter to apply to the query. * * @return array The most recently modified posts. */ private function get_recently_modified_posts_wp_query( string $post_type, int $limit, bool $exclude_older_than_one_year, string $search_filter = '' ): array { $args = [ 'post_type' => $post_type, 'posts_per_page' => $limit, 'post_status' => 'publish', 'orderby' => 'modified', 'order' => 'DESC', 'has_password' => false, ]; if ( $exclude_older_than_one_year === true ) { $args['date_query'] = [ [ 'after' => '12 months ago', ], ]; } if ( $search_filter !== '' ) { $args['s'] = $search_filter; } $posts = []; foreach ( \get_posts( $args ) as $post ) { $posts[] = Content_Type_Entry::from_post( $post, \get_permalink( $post->ID ) ); } return $posts; } } one year. * * @return array The most recently modified posts. */ public function get_recent_posts( string $post_type, int $limit, string $search_filter = '', bool $disable_excluding_old_posts = false ): array { $exclude_older_than_one_year = false; if ( $post_type === 'post' && ! $disable_excluding_old_posts ) { $exclude_older_than_one_year = true; } if ( $this->indexable_helper->should_index_indexables() ) { return $this->get_recently_modified_posts_indexables( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); } return $this->get_recently_modified_posts_wp_query( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); } /** * Returns most recently modified posts of a post type, using indexables. * * @param string $post_type The post type. * @param int $limit The maximum number of posts to return. * @param bool $exclude_older_than_one_year Whether to exclude posts older than one year. * @param string $search_filter Optional. The search filter to apply to the query. * * @return array The most recently modified posts. */ private function get_recently_modified_posts_indexables( string $post_type, int $limit, bool $exclude_older_than_one_year, string $search_filter = '' ): array { $posts = []; $recently_modified_indexables = $this->indexable_repository->get_recently_modified_posts( $post_type, $limit, $exclude_older_than_one_year, $search_filter ); foreach ( $recently_modified_indexables as $indexable ) { $indexable_meta = $this->meta->for_indexable( $indexable ); if ( $indexable_meta->post instanceof WP_Post ) { $posts[] = Content_Type_Entry::from_meta( $indexable_meta ); } } return $posts; } /** * Returns most recently modified posts of a post type, using WP_Query. * * @param string $post_type The post type. * @param int $limit The maximum number of posts to return. * @param bool $exclude_older_than_one_year Whether to exclude posts older than one year. * @param string $search_filter Optional. The search filter to apply to the query. * * @return array The most recently modified posts. */ private function get_recently_modified_posts_wp_query( string $post_type, int $limit, bool $exclude_older_than_one_year, string $search_filter = '' ): array { $args = [ 'post_type' => $post_type, 'posts_per_page' => $limit, 'post_status' => 'publish', 'orderby' => 'modified', 'order' => 'DESC', 'has_password' => false, ]; if ( $exclude_older_than_one_year === true ) { $args['date_query'] = [ [ 'after' => '12 months ago', ], ]; } if ( $search_filter !== '' ) { $args['s'] = $search_filter; } $posts = []; foreach ( \get_posts( $args ) as $post ) { $posts[] = Content_Type_Entry::from_post( $post, \get_permalink( $post->ID ) ); } return $posts; } } Page non trouvée -

Il semble que le lien pointant ici soit défectueux. Et si vous essayiez plutôt de rechercher ?

Reset password

Entrez votre adresse e-mail et nous vous enverrons un lien pour changer votre mot de passe.

Commencez avec votre compte

pour enregistrer vos maisons préférées et plus encore

Inscrivez-vous avec l'adresse e-mail

Commencez avec votre compte

pour enregistrer vos maisons préférées et plus encore

By clicking the «S'INSCRIRE» button you agree to the Conditions d'utilisation and Politique de confidentialité
Powered by Estatik