首页 > 解决方案 > Javascript 中的高级自定义字段 (Wordpress)

问题描述

我正在尝试在我的 Javascript 中显示转发器字段。我有一个图表,正在尝试与转发器字段混合:

这是我的代码:

jQuery(document).ready(function () {
    jQuery("#mapsvg").mapSvg({
      markerLastID: 20,
      width: 600.4892,
      height: 599.41095,
      colors: {
        baseDefault: "#ffffff",
        selected: 40,
        hover: 20,
        directory: "#ffffff",
        status: {},
        base: "#f2642f",
        stroke: "#1010108a",
        background: "#fff"
      },
      regions: {
        <?php if ( have_rows( 'towns' ) ) : ?>
          <?php while ( have_rows( 'towns' ) ) : the_row(); ?>
          "<?php the_sub_field( 'title_id' ); ?>": {
                id: "<?php the_sub_field( 'title_id' ); ?>",
                id_no_spaces: "<?php the_sub_field( 'title_id' ); ?",
                title: " <?php the_sub_field( 'title' ); ?>",
                disabled: true,
                data: {},
              },
          <?php endwhile; ?>
        <?php else : ?>
          <?php 
        <?php endif; ?>

    });
});

有人可以帮我解决这个问题吗?

标签: javascriptphpwordpressadvanced-custom-fields

解决方案


推荐阅读