1

我一再尝试在 Vantage 主题(来自 AppThemes)中实现高级自定义字段 (ACF) 插件,但没有任何成功。在这个问题上,我与 ACF 的管理员进行了广泛的接触,但不幸的是我们没有成功。他建议在这里问,也许寻找(付费)开发人员来解决这个问题。

好的,那我在尝试什么?我创建了一个自定义字段组,并希望在 Vantage 的列表形式中实现该字段组。为此,我阅读了几个文档,包括: http: //www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/。为了完整,基于此,我在 Vantage 主题文件夹中执行了以下操作:

  1. 我创建了 2 个自定义字段组,ID 为:88 和 139。
  2. 在 Wrapper.php 我添加了代码:<?php acf_form_head(); ?>
  3. 在 form-listing.php 我创建了 2 个自定义钩子,“product_custom”和“product_custom2”:<?php do_action( 'product_custom' ); ?> <?php do_action( 'product_custom2' ); ?>
  4. 在 fuctions.php 中,我创建了 3 个函数:

    add_action( 'wp_print_styles' , 'my_deregister_styles' , 100 );
    function my_deregister_styles() {
        wp_deregister_style( 'wp-admin'  );
    }
    
    add_action( 'product_custom'   , 'productfields'   );
    function productfields() {
        $options = array(
            'field_groups'   => array('post'   => '88'  ),
        'form'   => false,
    );
        acf_form( $options );
    }
    
    add_action( 'product_custom2'   , 'productfields2'   );
    function productfields2() {
        $options2 = array(
            'field_groups'   => array('post'   => '139'  ),
        'form'   => false,
    );
        acf_form( $options2 );
    }
    

这实际上使自定义字段组显示在 Vantage 的列表形式中。但是,以下事情总是出错:

  1. 两个字段组都有一个 WYSIWYG 字段。但是由于某种原因,所见即所得按钮和媒体按钮停止工作
  2. 我无法在第一个 WYSIWYG 字段中填写任何文本。只有第二个适用于此。
  3. 保存列表表单后,根本不存储任何数据。在 ACF 管理员的建议下,我在 acf-master/core/api.php 文件中尝试了以下操作:

    // run database save first
            if( isset($_POST['acf_save']) )
            {
                $txt="Hello world!";
        echo $txt;
        die();
    

但是,在保存列表表单后,该字符串不会显示。所以不使用if语句... 4.要在前端显示数据,一旦保存,我想可以使用默认的wordpress codex..

我试图尽可能完整;)有没有人可以进一步帮助我?有偿援助也可协商。

提前非常感谢!罗伯特

4

2 回答 2

1

我已经成功实施了具有优势主题的 ACF。

我在 vantage 列表表单中添加了 ACF 表单,并将 vantage 表单与 ACF 表单结合起来。一键式。

数据已存入数据库,可调用显示在列表区。仅添加图像按钮在前端不起作用,但在后端该按钮起作用。

  1. 添加<?php acf_form_head(); ?>到 wrapper.php

  2. 做这个教程前端表单帮助

  3. 消除 form-listing.php 中的默认 vantage 提交按钮

  4. 在 ACF api.php 函数中添加此代码acf_form_head()

     // allow for custom save
    
    $post_id = apply_filters('acf_form_pre_save_post','va_after_create_listing_form', $post_id);
    

就是这样,希望它适用于您的网站。

于 2013-07-05T08:22:42.637 回答
0

Is that you want when someone visits the website that they are able to send info via the page they visits eg www.yoursite.com/listing/listing-name like probably an email or contact for more info relating to that business?

If not then you can simply add in the ACF data from the back-end i.e. dreamweaver etc onto single-listing.php and use the ACF tutorial on working with fields.

Hope this helps somewhat

Cheers

于 2013-06-30T03:40:16.010 回答