我会用shortcode 我自己在你的functions.php
:
function wpa_85620_calculator_shortcode( $atts ) {
extract( shortcode_atts( array(
\'key\' => \'wr4nht4qbp\',
\'width\' => 800,
\'height\' => 800
), $atts ) );
return sprintf( \'<object data="https://www.desmos.com/calculator/%s" width="%d" height="%d"></object>\', $key, $width, $height );
}
add_shortcode( \'calculator\', \'wpa_85620_calculator_shortcode\' );
在您的帖子/页面中:
[calculator] or [calculator width="400" height="200"]
作为插件(另存为
calc.php
在您的
plugins
文件夹):
<?php
/*
Plugin Name: Desmos Calculator
Plugin URI: http://wordpress.stackexchange.com/questions/85620/object-data-object-changes-after-i-save-a-post/85669#85669
Description: Desmos calculator shortcode
Version: 0.1
Author: Joseph Leedy
Author Email: [email protected]
License:
Copyright 2013 Joseph Leedy ([email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
function wpa_85620_calculator_shortcode( $atts ) {
extract( shortcode_atts( array(
\'key\' => \'wr4nht4qbp\',
\'width\' => 800,
\'height\' => 800
), $atts ) );
return sprintf( \'<object data="https://www.desmos.com/calculator/%s" width="%d" height="%d"></object>\', $key, $width, $height );
}
add_shortcode( \'calculator\', \'wpa_85620_calculator_shortcode\' );