:WordPress 获取当前文章ID的方法

:

  if (!is_page() && !is_home()){

  $catsy = get_the_category(); $myCat = $catsy[0]->cat_ID; $currentcategory = '¤t_category='.$myCat;

  }

  wp_list_categories('hierarchical=1&use_desc_for_title=0&exclude=12&depth=1&orderby=id&title_li='.$currentcategory);

  ?>

  第四种:

  [代码]php代码:

  <?php

  foreach((get_the_category()) as $category) {

  echo $category->cat_ID . ''; //当前文章的分类的ID


上一篇: 如何让wordpress支持中文用户名

下一篇: wordpress 如何设置为404页面

最新文章

热门文章

快读网 轻松阅读 享受快乐生活

网站邮箱:wodd7@hotmail.com

Top