wordpress 获取指定作者或者文章的所有评论数量 <?php $args = array( 'post_author' => '' // fill in post author ID ); $author_comments = get_comments($args); echo count($author_comments); 根据上面提示的内容,可以查询到指定文章的评论数量  …
不同平台获取指定目录内容的详细信息命令各不相同: Linux中可以通过ls -al获取获取 windows中可以通过dir命令获取 下面是我写的一个通用获取目录内容详细信息的python3脚本: #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os, time, sys from os.path import join, getsize def ListDir(dir_data): ''' :param dir_data: 指定获取内容…
原文:http://blog.csdn.net/vchao13/article/details/6200255 1.获取指定目录下所有文件信息 /// <summary> /// 返回指定目录下所有文件信息 /// </summary> /// <param name="strDirectory">目录字符串</param> /// <returns></returns> public List<FileIn…
get_term:直接从数据库中获取分类信息get_the_category:使用post_id作为参数,先根据post_id查询对应的文章然后再返回对应的分类信息,如果没有文章信息则返回Null 之前一直get_the_category是根据cat_id获取分类信息来着的,今天当我使用该方法获取cat_id=2的分类信息时,因为该分类没有添加文章所以一直都没有返回值,直到跟踪到源文件才知道这两者的区别 //$term_id:分类ID号 //$taxonomy:category|link_cat…
get_cat_ID()    根据分类名称获取分类ID   ///// get_cat_name()    根据分类ID获取分类名称 用法:<?phpget_cat_ID( $cat_name ) ?> 参数:$cat_name  分类名称默认值为"General".类型为字符型,可选 返回的值:出错时返回0,成功则返回分类ID号,类型为整数 示例: <?php          $category_id= get_cat_id('CategoryName');  …
反过来,我们可能会有这样的需求,既然可以获取某个分类的关联标签,那我能获取某个标签的关联分类吗?答案是可以的,将上面的代码稍微改一下就可以了: function ludou_get_tag_categories($args) { global $wpdb; $categories = $wpdb->get_results (" SELECT DISTINCT terms1.term_id as cat_id FROM $wpdb->posts as p1 LEFT JOIN $wpd…
$args = array( 'post_type' => array( 'post','knowledgebase'), 'post_status' => 'publish', 'author' => $author_id, 'numberposts'=> $author_all_posts ); post_title $posts = get_posts($args); $votes_likes_sum = ; ; $i < count($posts); $i++) {…
/// <summary> /// 返回指定目录下所有文件信息 /// </summary> /// <param name="strDirectory">目录字符串</param> /// <returns></returns> public List<FileInfo> GetAllFilesInDirectory(string strDirectory) { List<FileInfo>…
为方便Azure用户导出已创建虚拟机的相关信息,特编写如下脚本: 详情脚本: # 登陆Azure Account Add-AzureRmAccount -EnvironmentName AzureChinaCloud # 设置订阅ID $sub = "******" Select-AzureRmSubscription -Subscription $sub # 设置Excel格式 $excel = New-Object -ComObject Excel.Application $wor…
为方便Azure用户导出已创建虚拟机的相关信息,特编写如下脚本: 详情脚本: # 登陆Azure Account Add-AzureAccount -Environment AzureChinaCloud # 设置订阅ID $sub = "******" Select-AzureSubscription -SubscriptionName $sub # 设置Excel格式 $excel = New-Object -ComObject Excel.Application $workboo…