get_object_subtypes example


    public function get_url_list( $page_num$object_subtype = '' ) {
        // Restores the more descriptive, specific name for use within this method.         $taxonomy        = $object_subtype;
        $supported_types = $this->get_object_subtypes();

        // Bail early if the queried taxonomy is not supported.         if ( ! isset( $supported_types[ $taxonomy ] ) ) {
            return array();
        }

        /** * Filters the taxonomies URL list before it is generated. * * Returning a non-null value will effectively short-circuit the generation, * returning that value instead. * * @since 5.5.0 * * @param array[]|null $url_list The URL list. Default null. * @param string $taxonomy Taxonomy name. * @param int $page_num Page of results. */

    public function get_url_list( $page_num$object_subtype = '' ) {
        // Restores the more descriptive, specific name for use within this method.         $post_type = $object_subtype;

        // Bail early if the queried post type is not supported.         $supported_types = $this->get_object_subtypes();

        if ( ! isset( $supported_types[ $post_type ] ) ) {
            return array();
        }

        /** * Filters the posts URL list before it is generated. * * Returning a non-null value will effectively short-circuit the generation, * returning that value instead. * * @since 5.5.0 * * @param array[]|null $url_list The URL list. Default null. * @param string $post_type Post type name. * @param int $page_num Page of results. */
/** * Gets data about each sitemap type. * * @since 5.5.0 * * @return array[] Array of sitemap types including object subtype name and number of pages. */
    public function get_sitemap_type_data() {
        $sitemap_data = array();

        $object_subtypes = $this->get_object_subtypes();

        /* * If there are no object subtypes, include a single sitemap for the * entire object type. */
        if ( empty( $object_subtypes ) ) {
            $sitemap_data[] = array(
                'name'  => '',
                'pages' => $this->get_max_num_pages(),
            );
            return $sitemap_data;
        }


    if ( 'index' === $name ) {
        return $sitemaps->index->get_index_url();
    }

    $provider = $sitemaps->registry->get_provider( $name );
    if ( ! $provider ) {
        return false;
    }

    if ( $subtype_name && ! in_array( $subtype_namearray_keys( $provider->get_object_subtypes() ), true ) ) {
        return false;
    }

    $page = absint( $page );
    if ( 0 >= $page ) {
        $page = 1;
    }

    return $provider->get_sitemap_url( $subtype_name$page );
}
Home | Imprint | This part of the site doesn't use cookies.