在Wordpress主题中使用SMOF

时间:2014-06-06 15:17:27

标签: wordpress

我想给出一个条件来选择一个类别来显示我主题中特定类别的帖子。使用smof框架我无法做到这一点。

query_posts('category_name=hot&showposts=1'); 
if ( have_posts() ) while ( have_posts() ) : the_post();

我的代码是否显示来自类别" hot"的特色帖子;但我想给出一个从主题选项中选择类别的条件。

这是创建选择类别的smof代码

$of_options[] = array(  "name"      => "Select a Category",
        "desc"      => "A list of all the categories being used on the site.",
        "id"        => "example_category",
        "std"       => "Select a category:",
        "type"      => "select",
        "options"   => $of_categories
                );

如何使用此功能?

1 个答案:

答案 0 :(得分:0)

这项工作

  $of_options[] = array( "name" => "Select a Category",
  "desc" => "A list of all the categories being used on the site.",
  "id" => "id_cat-name",
  "std" => "select category",
  "type" => "select",
  "options" => $of_categories);`