类别存档上带有Timber的ACF选项页面内容

我有一个项目上运行的ACF选项页面内容。到目前为止,该功能在任何页面上都有效。看起来像这样:

// functions.php

if( function_exists('acf_add_options_page') ) {
    acf_add_options_page(array(
      'page_title'  => 'Allgemeines','menu_title'  => 'Allgemeines','menu_slug'   => 'allgemeines','capability'  => 'edit_posts','redirect'    => true
    ));
}

public function add_to_context( $context ) {
    // some lines …
    $context['options'] = get_fields('options');
    $context['site'] = $this;
    return $context;
}
{# page.twig #}
{{ options.adresse }}
{{ options.mail }}
...

但是,关于类别存档,没有输出,我也不知道该怎么办。 {{ dump(options) }}导致 bool(false)

这是category.php:

<?php

$templates = array( 'category-ofen.twig' );
$context = Timber::get_context();
$context['title'] = single_cat_title( '',false );
$context['posts'] = new Timber\PostQuery();

Timber::render( $templates,$context );

有什么想法吗?我必须在那里更改一些东西吗?

hebeipl 回答:类别存档上带有Timber的ACF选项页面内容

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2770004.html

大家都在问