dsmnedc798226 2014-11-17 18:21
浏览 90
已采纳

WordPress高级自定义字段 - 使用数组中的选择字段和修改数组元素

I'm working on a WordPress website. I am using the ACF Pro plugin. I have a select field and I want to assign a second value to each option. The first value is being used as a heading. The second is a percentage figure (at the moment just a string). This will be used as a label as well as a data-percentage value. I cant get the select values to work with my array. Here is my code.

 <h4>Qualification: <?php echo $array_test; ?></h4>

And then the array;

        <?php
            $myArray = array('$array_tests');
            $myArray[0]= '20%';
            $myArray[1]= '40%';
            $myArray[2]= '60%';
            $myArray[3]= '80%';
            $myArray[4]= '100%';

            echo "<h1> Test:";  
            echo $myArray;
            echo "<h1>";                    

        ?>

And finally using the modified array's output as a data-percentage;

<div class="skillbar clearfix" data-percent="<?php echo $myArray ?>%">
  • 写回答

2条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 VB6.0使用WebBrowser控件打开网页总是弹出js错误提示,请解决。
      • ¥20 如何按照企业名字进行爬虫
      • ¥15 关于#单片机波形发生器频率计算#的问题,如何解决?
      • ¥100 制作短链接和api接口的
      • ¥15 星河亮点sp9500测试指导
      • ¥15 dataframe 某列数据分列
      • ¥15 风扇导入fluent后仿真压力和速度数据卡在旋转域
      • ¥15 echarts中dataZoom报错
      • ¥15 求解答:《前端综合基础》作为一门课程的话,应该包含哪些内容?
      • ¥15 软件原型系统开发+实例测试