【问题标题】:Adding a Custom Page Template into Warp Theme for bbPress将自定义页面模板添加到 bbPress 的 Warp 主题中
【发布时间】:2011-12-02 02:30:56
【问题描述】:

(这篇文章已在 Yootheme 论坛上提交,但我对解决方案没有那么大的信心,所以我想我也会在这里发布。)

我正在使用 Yoothemes 的 Nano 主题,它在我的 90% 的网站上运行良好。 http://dofekit.org 但是我刚刚安装了 bbPress 论坛插件(不是在实时站点上,而是在本地版本上)并且我创建了 2 个“论坛”。论坛索引页面和所有子页面似乎都插入到标准的 Nano 页面模板中。这不适合论坛,因为它包含页面元信息,而且我认为无法关闭论坛的“sidebar-a”,如我的屏幕截图所示。

http://dl.dropbox.com/u/240752/forums.jpg

有没有办法在 yoothemes 框架内为论坛帖子类型创建单独的模板? (我知道它是专有的,但我可以问)

谢谢。

更新:

我是其中的一部分。我已经设法为我的论坛帖子类型制作单独的模板,但我仍然需要在小部件设置中确认自定义帖子类型。

我在 warp/systems/wordpress3.0/layouts/content.php

中添加了自定义帖子类型
if (is_home()) {
    $content = 'index';
} elseif (is_page()) {
    $content = 'page';
} elseif (is_attachment()) {
    $content = 'attachment';
} elseif ((is_single()) && (get_post_type() == 'forum')) {
    $content = 'forum-single';
}elseif ((is_single()) && (get_post_type() == 'topic')) {
    $content = 'topic-single';
} elseif (is_single()) {
    $content = 'single';
} elseif (is_search()) {
    $content = 'search';
}elseif ((is_archive()) && (get_post_type() == 'forum')) {
    $content = 'forum-archive';
} elseif (is_archive() && is_author()) {
    $content = 'author';
} elseif (is_archive()) {
    $content = 'archive';
} elseif (is_404()) {
    $content = '404';
}

我还将这些自定义帖子类型添加到 warp/systems/wordpress3.0/config/layouts/fields/profile.php 为了让它们出现在每个小部件的下拉列表中。 (我希望能够在这些新的自定义模板上切换小部件。)

$defaults = array(
    'home'    => 'Home',
    'archive' => 'Archive',
    'search'  => 'Search',
    'single'  => 'Single',
    'page'    => 'Pages',
    'forum-archive' => 'Forum List',
    'forum-single' => 'Forum Single',
    'topic-single' => 'Topic Single'
);

有人可以帮忙吗?我想我快要完成了。

【问题讨论】:

  • “让自定义帖子类型在小部件设置中得到确认”到底是什么意思?这是您唯一的问题还是还有更多问题?老实说,“任何人都可以帮忙”不是最好的问题;)

标签: wordpress plugins themes bbpress


【解决方案1】:

您应该能够为 single post display 的自定义帖子类型使用 WordPress 模板来处理此问题。

例如,如果您的自定义帖子类型称为“产品”,请创建一个名为 single-product.php 的模板,例如单{post_type}.php

无论 Yoothemes 框架如何,此解决方案都应该有效,如果有效,请告诉我!

【讨论】:

    【解决方案2】:

    我不确定我的回答是否可以帮助你,但是......

    我的代码将自定义分类类别添加到小部件位置...

    我编辑文件 warp/systems/wordpress/config/layouts/fields/style.php

    我为每个自定义分类添加这一行 =)

    // set Eventos cate
        if ($categories = get_categories(array('hide_empty' => 0, 'name' => 'select_name', 'post_type' => 'event', 'taxonomy'  => 'event-category'))) {
            $options[] = '<optgroup label="Eventos | Categorias">';
    
            foreach ($categories as $category) {
                $val        = 'cat-'.$category->cat_ID;
                $attributes = in_array($val, $selected) ? array('value' => $val, 'selected' => 'selected') : array('value' => $val);
                $options[]  = sprintf('<option %s />%s</option>', $control->attributes($attributes), $category->cat_name);
            }
    
            $options[] = '</optgroup>';                  
        }
    

    这里...我的 postype 是 "event" 并且我的分类是 "event-category" 在小部件位置列表中现在您可以看到所有类别或分类学术语,并用“Eventos | Categorias”标记它,以便更好地识别。

    好的,这只是代码的一部分,也许您可​​以以此为起点。现在我只能显示和列出这些术语但仍然可以正常工作:(

    所以... tnks 为 cmets 和对不起我的英语:P

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-29
      • 1970-01-01
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多