我知道如何在我的Wordpress网站上显示最受欢迎的标签。但我想将其过滤到特定类别。
在数组中添加类似于'cat'=> 1之类的行不起作用。
这是我用来显示最受欢迎标签的代码(有效):
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class App {
public static List listA = new ArrayList();
public static void main(String[] args) {
matchSplits();
}
public static void matchSplits()
{
String header = "Name_DS_1" + "," + "LineString_1" + "," + "UFI_1" + "," + "Name_DS_2" + "," + "LineString_2" + "," + "UFI_2" + "\r\n";
String fileName = "D:\\WIP\\test\\Coordinates.txt";
File file = new File(fileName);
int matchCount = 0;
try (PrintWriter writer = new PrintWriter(file)) {
for (int k=0;k<3;k++) {
//Here I am inserting the header only in the first iteration.
if(matchCount == 0) {
writer.write(header);
}
String Name_DS_1 = "Name1";
String LineString_1 = "Line1";
String UFI_1 = "Ufi1";
String Name_DS_2 = "Name2";
String LineString_2 = "Line2";
String UFI_2 = "Ufi2";
String line = Name_DS_1 + "," + LineString_1 + "," + UFI_1 + "," + Name_DS_2 + "," + LineString_2 + "," + UFI_2 + "\r\n";
listA.add(line);
for(int i=0; i<listA.size(); i++) {
writer.println(listA.get(i));
}
writer.close();
matchCount++;
}
}
catch (FileNotFoundException e) {
System.out.println(e.getMessage());
}
}
}
有人可以帮忙吗?