s as $item ) { $lastMod = $item->date_modified ?: $item->date_created; $entry = [ 'loc' => BuddyPressIntegration::getComponentSingleUrl( 'group', BuddyPressIntegration::callFunc( 'bp_get_group_by', 'id', $item->id ) ), 'lastmod' => aioseo()->helpers->dateTimeToIso8601( $lastMod ), 'changefreq' => aioseo()->sitemap->priority->frequency( 'postTypes', false, $postType ), 'priority' => aioseo()->sitemap->priority->priority( 'postTypes', false, $postType ), ]; $entries[] = apply_filters( 'aioseo_sitemap_post', $entry, $item->id, $postType ); } $archiveUrl = BuddyPressIntegration::getComponentArchiveUrl( 'group' ); if ( aioseo()->helpers->isUrl( $archiveUrl ) && ! in_array( $postType, aioseo()->helpers->getNoindexedObjects( 'archives' ), true ) ) { $lastMod = ! empty( $items[0] ) ? $items[0]->date_modified : current_time( 'mysql' ); $entry = [ 'loc' => $archiveUrl, 'lastmod' => $lastMod, 'changefreq' => aioseo()->sitemap->priority->frequency( 'postTypes', false, $postType ), 'priority' => aioseo()->sitemap->priority->priority( 'postTypes', false, $postType ), ]; array_unshift( $entries, $entry ); } return apply_filters( 'aioseo_sitemap_posts', $entries, $postType ); } /** * Returns all entries for the BuddyPress Member Sitemap. * This method is automagically called from {@see get()} if the current index name equals to 'bp-member' * * @since 4.7.6 * * @return array The sitemap entries. */ public function bpMember() { $entries = []; if ( ! in_array( aioseo()->sitemap->indexName, aioseo()->sitemap->helpers->includedPostTypes(), true ) ) { return $entries; } $postType = 'bp-member'; $query = aioseo()->core->db ->start( 'bp_activity as a' ) ->select( '`a`.`user_id` as id, `a`.`date_recorded`' ) ->whereRaw( "a.component = 'members' AND a.type = 'last_activity'" ) ->limit( aioseo()->sitemap->linksPerIndex, aioseo()->sitemap->offset ) ->orderBy( '`a`.`date_recorded` DESC' ); $items = $query->run() ->result(); foreach ( $items as $item ) { $entry = [ 'loc' => BuddyPressIntegration::getComponentSingleUrl( 'member', $item->id ), 'lastmod' => aioseo()->helpers->dateTimeToIso8601( $item->date_recorded ), 'changefreq' => aioseo()->sitemap->priority->frequency( 'postTypes', false, $postType ), 'priority' => aioseo()->sitemap->priority->priority( 'postTypes', false, $postType ), ]; $entries[] = apply_filters( 'aioseo_sitemap_post', $entry, $item->id, $postType ); } $archiveUrl = BuddyPressIntegration::getComponentArchiveUrl( 'member' ); if ( aioseo()->helpers->isUrl( $archiveUrl ) && ! in_array( $postType, aioseo()->helpers->getNoindexedObjects( 'archives' ), true ) ) { $lastMod = ! empty( $items[0] ) ? $items[0]->date_recorded : current_time( 'mysql' ); $entry = [ 'loc' => $archiveUrl, 'lastmod' => $lastMod, 'changefreq' => aioseo()->sitemap->priority->frequency( 'postTypes', false, $postType ), 'priority' => aioseo()->sitemap->priority->priority( 'postTypes', false, $postType ), ]; array_unshift( $entries, $entry ); } return apply_filters( 'aioseo_sitemap_posts', $entries, $postType ); } /** * Returns all entries for the WooCommerce Product Attributes sitemap. * Note: This sitemap does not support pagination. * * @since 4.7.8 * * @param bool $count Whether to return the count of the entries. This is used to determine the indexes. * @return array The sitemap entries. */ public function productAttributes( $count = false ) { $aioseoTermsTable = aioseo()->core->db->prefix . 'aioseo_terms'; $wcAttributeTaxonomiesTable = aioseo()->core->db->prefix . 'woocommerce_attribute_taxonomies'; $termTaxonomyTable = aioseo()->core->db->prefix . 'term_taxonomy'; $selectClause = 'COUNT(*) as childProductAttributes'; if ( ! $count ) { $selectClause = aioseo()->pro ? 'tt.term_id, at.frequency, at.priority' : 'tt.term_id'; } $joinClause = aioseo()->pro ? "LEFT JOIN {$aioseoTermsTable} AS at ON tt.term_id = at.term_id" : ''; $whereClause = aioseo()->pro ? 'AND (at.robots_noindex IS NULL OR at.robots_noindex = 0)' : ''; $limitClause = $count ? '' : 'LIMIT 50000'; $result = aioseo()->core->db->execute( "SELECT {$selectClause} FROM {$termTaxonomyTable} AS tt JOIN {$wcAttributeTaxonomiesTable} AS wat ON tt.taxonomy = CONCAT('pa_', wat.attribute_name) {$joinClause} WHERE wat.attribute_public = 1 {$whereClause} AND tt.count > 0 {$limitClause};", true )->result(); if ( $count ) { return ! empty( $result[0]->childProductAttributes ) ? (int) $result[0]->childProductAttributes : 0; } if ( empty( $result ) ) { return []; } $entries = []; foreach ( $result as $term ) { $term = (object) $term; $termId = (int) $term->term_id; $entry = [ 'loc' => get_term_link( $termId ), 'lastmod' => $this->getTermLastModified( $termId ), 'changefreq' => aioseo()->sitemap->priority->frequency( 'taxonomies', $term, 'product_attributes' ), 'priority' => aioseo()->sitemap->priority->priority( 'taxonomies', $term, 'product_attributes' ), 'images' => aioseo()->sitemap->image->term( $term ) ]; $entries[] = apply_filters( 'aioseo_sitemap_product_attributes', $entry, $termId ); } return $entries; } }