dongling4383 2019-04-24 16:58 采纳率: 100%
浏览 62

有没有办法让我编辑一个插件,以便在短代码中使用短代码?

I am currently working on creating a website and have to pull some constantly changing data from a google sheet. I have already developed a plugin for that and now I need to figure out how to use that shortcode inside of the shortcode for another plugin. (That plugin makes and updates progress bars if you are curious) I can not figure out how to make this work

I know the shortcode of my plugin works on its own and the shortcode for the progress bar plugin works on its own.

My plugin

function sheet_value_shortcode($atts) {
    $API = 'REDACTED';
    $google_spreadsheet_ID = 'REDACTED';
    $api_key = esc_attr( $API);

    $location = $atts['location'];

    $get_cell = new WP_Http();
    $cell_url = "https://sheets.googleapis.com/v4/spreadsheets/$google_spreadsheet_ID/values/$location?&key=$api_key";  
    $cell_response = $get_cell -> get( $cell_url);
    $json_body = json_decode($cell_response['body'],true);  
    $cell_value = $json_body['values'][0][0];
    return $cell_value;

I want it to pull the data from a cell of the spreadsheet and use it instead of having to go in and manually update the number everytime

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题