让我们假设商店所有者想隐藏所有评论并禁用他商店的评论。如何实现?
答案 0 :(得分:0)
一个。创建一个名为'geodir_togReview'的复选框字段:GD-> Place settings-> Checkbox->将HTML var name设置为'togReview'
湾在geodirectory-compatibility.php中添加
// this line tells the tabs function to run our new function to remove a tab
add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_remove_tab_conditional');
// this function removes the tab to the tabs list
function geodir_detail_page_tab_list_remove_tab_conditional($tab_array)
{
// the $post var contains all the listing info so we can add conditions
global $post, $preview;
if ($preview)
$is_place = $post->listing_type=='gd_place';
else
$is_place = $post->post_type=='gd_place';
// HIDE OR SHOW
if ($is_place && $post->geodir_togReview) {
$tab_array['reviews']['is_active_tab'] = 0;
$tab_array['reviews']['is_display'] = 0;
//unset($tab_array['reviews']);//remove the tab
} else {
$tab_array['reviews']['is_active_tab'] = 1;
$tab_array['reviews']['is_display'] = 1;
}
return $tab_array;
}