'.esc_html__('Powered by "WP Sitemap Page"', 'wp-sitemap-page').'
'; } // Exclude pages, posts and CTPs protected by password if ($wsp_is_exclude_password_protected==1) { global $wpdb; // Obtain the password protected content $sql = 'SELECT ID FROM '.$wpdb->posts.' WHERE post_status = \'publish\' AND post_password <> \'\' '; $password_pages = $wpdb->get_col($sql); // add to the other if not empty if (!empty($password_pages)) { // convert array to string $exclude_pages = implode(',', $password_pages); // Add the excluded page to the other protected page if (!empty($wsp_exclude_pages)) { $wsp_exclude_pages .= ','.$exclude_pages; } else { $wsp_exclude_pages = $exclude_pages; } } } // check if the attribute "only" is used switch ($only_cpt) { // display only PAGE case 'page': return wsp_return_content_type_page($is_title_displayed, $is_get_only_private, $display_nofollow, $wsp_exclude_pages, $sort).$copyright_link; break; // display only POST case 'post': return wsp_return_content_type_post($is_title_displayed, $display_nofollow, $display_post_only_once, $is_category_title_wording_displayed, $wsp_exclude_pages, $sort, $sort, $order).$copyright_link; break; // display only ARCHIVE case 'archive': return wsp_return_content_type_archive($is_title_displayed, $display_nofollow).$copyright_link; break; // display only AUTHOR case 'author': return wsp_return_content_type_author($is_title_displayed, $display_nofollow, $sort).$copyright_link; break; // display only CATEGORY case 'category': return wsp_return_content_type_categories($is_title_displayed, $display_nofollow, $sort).$copyright_link; break; // display only TAGS case 'tag': return wsp_return_content_type_tag($is_title_displayed, $display_nofollow).$copyright_link; break; // empty case '': // nothing but do break; default: // check if it's the name of a CPT // extract CPT object $cpt = get_post_type_object( $only_cpt ); if ( !empty($cpt) ) { return wsp_return_content_type_cpt_items( $is_title_displayed, $display_nofollow, $cpt, $only_cpt, $wsp_exclude_pages, $sort ); } // check if it's a taxonomy $taxonomy_obj = get_taxonomy( $only_cpt ); if ( !empty($taxonomy_obj) ) { return wsp_return_content_type_taxonomy_items($is_title_displayed, $display_nofollow, $taxonomy_obj, $wsp_exclude_pages); } // end } //=============================================== // Otherwise, display traditionnal sitemap //=============================================== // List the PAGES (check if it should be exclude) if ( empty(get_option('wsp_exclude_cpt_page')) ) { $return .= wsp_return_content_type_page($is_title_displayed, $is_get_only_private, $display_nofollow, $wsp_exclude_pages, $sort); } // List the POSTS by CATEGORY (check if it should be exclude) if ( empty(get_option('wsp_exclude_cpt_post')) ) { $return .= wsp_return_content_type_post($is_title_displayed, $display_nofollow, $display_post_only_once, $is_category_title_wording_displayed, $wsp_exclude_pages, $sort, $sort, $order); } // List the CPT $return .= wsp_return_content_type_cpt_lists($is_title_displayed, $display_nofollow, $wsp_exclude_pages); // List the Taxonomies $return .= wsp_return_content_type_taxonomies_lists($is_title_displayed, $display_nofollow, $wsp_exclude_pages); // List the ARCHIVES (check if it should be exclude) if ( empty(get_option('wsp_exclude_cpt_archive')) ) { $return .= wsp_return_content_type_archive($is_title_displayed, $display_nofollow); } // List the AUTHORS (check if it should be exclude) if ( empty(get_option('wsp_exclude_cpt_author')) ) { $return .= wsp_return_content_type_author($is_title_displayed, $display_nofollow, $sort); } // return the content return $return.$copyright_link; } /** * Return list of pages * * @param bool $is_title_displayed * @param bool $is_get_only_private * @param bool $display_nofollow * @param array $wsp_exclude_pages * @param str $sort * @return str $return */ function wsp_return_content_type_page($is_title_displayed = true, $is_get_only_private = false, $display_nofollow = false, $wsp_exclude_pages = array(), $sort = null) { // init $return = ''; if ($display_nofollow==true) { add_filter('wp_list_pages', 'wsp_add_no_follow_to_links'); } // define the way the pages should be displayed $args = array(); $args['title_li'] = ''; $args['echo'] = '0'; // change the sort if ($sort!==null) { $args['sort_column'] = $sort; } // exclude some pages ? if (!empty($wsp_exclude_pages)) { $args['exclude'] = $wsp_exclude_pages; } // get only the private content if ($is_get_only_private==true) { $args['post_status'] = 'private'; } // get data $list_pages = wp_list_pages($args); // check it's not empty if (empty($list_pages)) { return ''; } // add content if ($is_title_displayed==true) { $return .= '