WP File Download - 目录管理插件,支持文件和文件夹的创建、编辑、删除等操作。
Simple Custom Post Order - 可以对WordPress中的所有文章、页面、分类目录、标签进行排序。
Category Order and Taxonomy Terms Order - 为分类目录、标签、自定义分类法等提供排序功能。
示例代码:
// 创建目录
$fileDownload = new wpfd_folder();
$fileDownload->name = 'test';
$fileDownload->parent = 0;
$fileDownload->save();
// 创建文件夹
$fileDownload = new wpfd_file();
$fileDownload->name = 'test.docx';
$fileDownload->parent = 1; //设置为上一级目录的ID
$fileDownload->path = '/wp-content/uploads/';
$fileDownload->save();
//shortcode: [simple_cpo_order]
// 可以使用orderby参数进行排序
function get_custom_post_type(){
$args = array(
'post_type' => 'custom_post_type',
'orderby' => 'menu_order', //使用自定义排序
'order' => 'ASC'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
//在此处输出文章内容
endwhile;
}
//shortcode: [catlist id=1 order_by=menu_order order=asc]
function my_custom_categories_shortcode($atts){
$atts = shortcode_atts( array(
'id' => 0,
'order_by' => 'name', //使用分类名进行排序
'order' => 'ASC'
), $atts, 'catlist' );
$cat_args = array(
'orderby' => $atts['order_by'],
'order' => $atts['order'],
'hide_empty' => 0,
'include' => $atts['id']
);
$categories = get_categories( $cat_args );
//在此处输出分类目录信息
}