[英]how to add custom url to sitemap in wordpress
I made a directory listing custom page for my WordPress website, http://arun.dealsinall.com/find-code , when we select state/city/town url update automatically, please tell me how can I add these all url to sitemap, 我为我的WordPress网站http://arun.dealsinall.com/find-code创建了一个目录列表自定义页面,当我们选择自动更新州/市/镇网址时,请告诉我如何将所有这些网址添加到站点地图中,
eg http://arun.dealsinall.com/find-code/haryana 例如http://arun.dealsinall.com/find-code/haryana
http://arun.dealsinall.com/find-code/haryana/kernal http://arun.dealsinall.com/find-code/haryana/kernal
Means every url automatically add to sitemap. 表示每个网址都会自动添加到站点地图中。
$current_state_slug = get_query_var('state'); //get state
$current_city_slug = get_query_var('city'); //get city
$current_town_slug = get_query_var('town'); //get town
$get_states = $wpdb->get_results("select * from state");
if(empty($current_state_slug)){
echo '<select id="selectbox">';
echo '<option>Select State</option>';
foreach($get_states as $states){
echo '<option value="'.$states->state_name.'">'.$states->state_name.'</option>';
}
echo "</select>";
}
else{
$chk_state = $wpdb->get_results("select * from state where state_name='$current_state_slug'");
if(empty($chk_state)){
echo '<br><span style="color:red;">sorry No data found for <span style="color:black">'.$current_state_slug.'</span></span><br/>';
echo '<select id="selectbox">';
echo '<option>Select State</option>';
foreach($get_states as $states){
echo '<option value="'.$states->state_name.'">'.$states->state_name.'</option>';
}
echo "</select>";
}
else{
echo '<a href="'. home_url().'/find-code"><i class="fa fa-refresh" aria-hidden="true"></i></a> : ';
echo '<select id="selectbox">';
foreach( $chk_state as $vfy_state){
echo '<option value="'.$vfy_state->state_name.'">'.$vfy_state->state_name.'</option>';
}
echo '</select><br>';
if(empty($current_city_slug)){
$city = $ak->get_current_state_city($vfy_state->state_id);
echo '<select id="selectbox_city"><option>Select City</option>';
foreach ($city as $city_list ){
echo '<option value="'.$city_list->city_name.'">'.$city_list->city_name.'</option>';
}
echo '</select><br>';
}}
}
i'm using rewrite_rules for my page and getting var using get_query_var and use java script code for adding dropdown values to url ,you can see functionality on website http://arun.dealsinall.com/find-code , 我正在为页面使用rewrite_rules并使用get_query_var获取var并使用java脚本代码向URL添加下拉值,您可以在http://arun.dealsinall.com/find-code网站上看到功能,
so tell me when i select first dropdown value named state, state value added to url, and i want to add this url to sitemap for seo purpose , and after every dropdown select , every url must me add in sitemap. 所以告诉我,当我选择第一个名为state的下拉值时,将state值添加到url中,并且我想将此URL添加到seo中以进行seo用途,并且在每次选择dropdown后,必须将每个url添加到sitemap中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.