【问题标题】:Using Pods CMS with Roots Wordpress Theme将 Pods CMS 与 Roots Wordpress 主题一起使用
【发布时间】:2014-08-19 05:18:27
【问题描述】:

我在使用 Roots Theme 的自定义 Wordpress 模板中显示 Pod 数据时遇到问题

我已经设置了一个“产品”Pod,一个已分配自定义 Wordpress 模板的 Pod 页面“products/*”。 Roots 使用了一个Theme Wrapper 文件,该文件似乎不适用于 Pods 页面。有没有人遇到过这个问题,也许找到了解决方案?

【问题讨论】:

  • 我也有同样的问题
  • 我最终创建了一个设置适当模板的新页面。最后,我使用add_rewrite_rule 添加了一个新的wordpress 路由。 add_rewrite_rule('locations/([^/]+)/?$', 'index.php?pagename=permalink&something=$matches[1]', 'top');

标签: wordpress podscms


【解决方案1】:

您可以添加自定义模板并将 pods_content() 放入其中您要输出内容的位置。

或者您可以连接到 get_template_part_templates/content 并检查 'page' 的第二个值,然后在那里运行 pods_content()。

add_action( 'get_template_part_templates/content', 'hook_into_pods_page', 2 );

function hook_into_pods_page ( $slug, $name ) {
    if ( is_pod_page() && 'page' == $name )
        pods_content();
}

【讨论】:

  • 我之前尝试过在模板中使用pods_content(),如您的文档here 中所示,但它不输出任何数据?我最喜欢显示 Pods 数据的解决方案是使用来自 Monday By Noon 的本教程,效果很好,只是主题包装器存在问题......
【解决方案2】:

我不知道这是否是一个“好”的解决方案。我昨天开始使用 Wordpress。

也就是说,这是我的解决方案,似乎效果很好。

在您的 pod 页面模板中,将页面的输出放入 $pods_content

$pods_content = $cookie->template('', get_pod_template('market-single'));
ob_start();
include get_stylesheet_directory() . '/base.php';
print ob_get_clean();

然后在 base.php 中替换 root_template_path 包含:

if ($pods_content): print $pods_content; else: include roots_template_path(); endif;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-13
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-31
    相关资源
    最近更新 更多