📄 wp_categories.php
字号:
<?phpif( ! defined( 'WP_CATEGORIES_INCLUDED' ) ) { define( 'WP_CATEGORIES_INCLUDED' , 1 ) ; function b_wp_categories_edit($options) { $form = ""; $form .= "列表类型: "; if ( $options[0] == 0 ) { $chk = " checked='checked'"; } $form .= "<input type='radio' name='options[]' value='0'".$chk." /> 简单列表"; $chk = ""; if ( $options[0] == 1 ) { $chk = " checked=\"checked\""; } $form .= " <input type='radio' name='options[]' value='1'".$chk." /> 下拉菜单"; $form .= "<br />显示内容: "; if ( $options[1] == 1 ) { $chk = " checked='checked'"; } $form .= "<input type='radio' name='options[1]' value='1'".$chk." /> "._YES.""; $chk = ""; if ( $options[1] == 0 ) { $chk = " checked=\"checked\""; } $form .= " <input type='radio' name='options[1]' value='0'".$chk." />"._NO.""; $form .= "<br />排序关键词: "; if ( $options[2] == 'ID' ) { $chk = " checked='checked'"; } $form .= "<input type='radio' name='options[2]' value='ID'".$chk." /> ".ID.""; $chk = ""; if ( $options[2] == 'name' ) { $chk = " checked=\"checked\""; } $form .= " <input type='radio' name='options[2]' value='name'".$chk." />".Name.""; $chk = ""; if ( $options[2] == 'description' ) { $chk = " checked=\"checked\""; } $form .= " <input type='radio' name='options[2]' value='description'".$chk." />".Description.""; $form .= "<br />顺序: "; if ( $options[3] == 'asc' ) { $chk = " checked='checked'"; } $form .= "<input type='radio' name='options[3]' value='asc'".$chk." /> ".Ascending.""; $chk = ""; if ( $options[3] == 'desc' ) { $chk = " checked=\"checked\""; } $form .= " <input type='radio' name='options[3]' value='desc'".$chk." />".Descending.""; return $form; } function b_wp_categories_show($options) { $block_style = ($options[0])?$options[0]:0; $with_count = ($options[1])?$options[1]:0; $sorting_key = ($options[2])?$options[2]:'name'; $sorting_order = ($options[3])?$options[3]:'asc'; global $wpdb, $siteurl, $user_cache, $cache_categories, $category_name, $cat; $id=1; $use_cache=1; require(dirname(__FILE__).'/../wp-config.php'); $cur_PATH = $_SERVER['SCRIPT_FILENAME']; if (preg_match("/^".preg_quote(XOOPS_ROOT_PATH."/modules/wordpress/","/")."/i",$cur_PATH)) { $cat = array_key_exists('cat',$_GET) ? intval($_GET['cat']) : null; $category_name = array_key_exists('category_name',$_GET) ? $_GET['category_name']: ''; if ($category_name and $cat==0) { $category_name = preg_replace('|/+$|', '', $category_name); $cat =$wpdb->get_var("SELECT cat_ID FROM {$wpdb->categories} WHERE category_nicename='$category_name'"); } } if ($block_style == 0) { // Simple Listing ob_start(); block_style_get(); echo "<ul class='wpBlockList'>\n"; wp_list_cats("sort_column=$sorting_key&sorting_order=$sorting_order&optioncount=$with_count"); echo "</ul>\n"; $block['content'] = ob_get_contents(); ob_end_clean(); } else { // Dropdown Listing $file = "$siteurl/index.php"; $link = $file.'?cat='; ob_start(); block_style_get(); echo '<form name="listcatform" action="">'; $select_str = '<select name="cat" onchange="window.location = (\''.$link.'\'+document.forms.listcatform.cat[document.forms.listcatform.cat.selectedIndex].value);"> '; dropdown_cats(1,_WP_LIST_CAT_ALL,$sorting_key,$sorting_order,0,$with_count); echo '</form>'; $block_str = ob_get_contents(); ob_end_clean(); $block['content'] = ereg_replace('\<select name\=[^\>]*\>',$select_str,$block_str); } return $block; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -