enfold主题对项目和项目分类自定义排序方法

首先用到一个 Intuitive Custom Post Order插件,wp后台可以搜索安装。然后在左侧设置菜单里勾选需要排序的项目。

第二步是添加代码

在后台,主题-外观-编辑里面,找到如下页面,enfold > config-templatebuilder > avia-shortcodes> portfolio > portfolio.php 添加代码

foreach($categories as $category)
			{
				if(in_array($category->term_id, $current_page_cats))
				{
					//fix for cyrillic, etc. characters - isotope does not support the % char
					$category->category_nicename = str_replace('%', '', $category->category_nicename);

					$output .= 	"<span class='text-sep ".$category->category_nicename."_sort_sep'>/</span>";
					$output .= 		'<a href="#" data-filter="'.$category->category_nicename.'_sort" class="'.$category->category_nicename.'_sort_button" ><span class="inner_sort_button">';
					$output .= 			"<span>".esc_html(trim($category->cat_name))."</span>";
					$output .= 			"<small class='av-cat-count'> ".$cat_count[$category->term_id]." </small></span>";
					$output .= 		"</a>";
				}
			}