我有两个相关的问题:
在媒体库中,当我单击“编辑图像”时,在左侧部分看不到允许裁剪的图像加载。同样,我无法编辑nggallery缩略图,没有加载带有裁剪器的图像。
此错误仅在使用“我的主题”时发生。当我换回来说二十一点时,效果很好。
然而,我不知道是什么原因导致了我的主题。
有什么建议吗?
编辑:我关注了toscho的评论,我注意到下面的代码导致了这里描述的问题。其中一个功能足以引发问题。
1) 此代码包含来自cdn的jquery
<?php
/************* INCLUDE JQUERY 1.10.0 FROM CDN *****************/
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script(\'jquery\');
wp_register_script(\'jquery\', "http" . ($_SERVER[\'SERVER_PORT\'] == 443 ? "s" : "") . "://code.jquery.com/jquery-latest.min.js", false, null);
wp_enqueue_script(\'jquery\');
}
?>
我自己编写的以下函数。。。
<?php
/*
* this is a helper function to get wordpress metadata
* for an attachment (wordpress media file)
*
*/
function custom_wp_get_attachment( $attachment_id ) {
$attachment = get_post( $attachment_id );
$path_parts = pathinfo($attachment->guid);
return array(
\'alt\' => get_post_meta( $attachment->ID, \'_wp_attachment_image_alt\', true ),
\'caption\' => $attachment->post_excerpt,
\'description\' => $attachment->post_content,
\'href\' => get_permalink( $attachment->ID ),
\'dirname\' => $path_parts[\'dirname\'],
\'basename\' => $path_parts[\'basename\'],
\'extension\' => $path_parts[\'extension\'],
\'filename\' => $path_parts[\'filename\'],
\'title\' => $attachment->post_title
);
}
?>
。
<?php
/************* REPLACE TAGS TO EMBED YOUKU VIDEOS *****************/
// [youku vid="video id" width="width" height="height"]
function youku_func( $atts ) {
$atts = shortcode_atts( array(
\'vid\' => \'\',
), $atts );
return "<iframe src=\'http://player.youku.com/embed/" . $atts[\'vid\'] . "\'></iframe>";
}
add_shortcode( \'youku\', \'youku_func\' );
?>
。
<?php
/************* REPLACE TAGS TO EMBED LOCAL VIDEOS *****************/
// [local video=""VideoName width="width" height="height"]
function localvideo_func( $atts ) {
$atts = shortcode_atts( array(
\'name\' => \'\',
\'width\' => "400",
\'height\' => "200",
), $atts );
$contentUrl = content_url();
return "<video width=\'" . $atts[\'width\'] ."\' height=\'" . $atts[\'height\'] . "\' controls>
<source src=\'$contentUrl/wp-content/uploads/" . $atts[\'name\'] . ".mp4\' type=\'video/mp4\' />
<source src=\'$contentUrl/uploads/" . $atts[\'name\'] . ".ogg\' />
<object width=\'" . $atts[\'width\'] . "\' height=\'" . $atts[\'height\'] . "\' type=\'application/x-shockwave-flash\' data=\'http://localhost/dangsters/wp-content/uploads/" . $atts[\'name\'] . ".swf\'>
<param name=\'movie\' value=\'$contentUrl/uploads/" . $atts[\'name\'] . "\'.swf\' />
<param name=\'flashvars\' value=\'controlbar=over&image=http://localhost/dangsters/wp-content/uploads/" . $atts[\'name\'] . ".jpg&file=http://localhost/dangsters/wp-content/uploads/" . $atts[\'name\'] . "\'.mp4\' />
<img src=\'$contentUrl/uploads/" . $atts[\'name\'] . ".jpg\' width=\'" . $atts[\'width\'] ."\' height=\'" . $atts[\'height\'] . "\' alt=\'" . $atts[\'name\'] . "\'
title=\'No video playback capabilities, please download the video below\' />
</object>
</video>
<p> <strong>Download Video:</strong>
Closed Format: <a href=\'$contentUrl/uploads/" . $atts[\'name\'] . ".mp4\'>MP4</a>
Open Format: <a href=\'$contentUrl/uploads/" . $atts[\'name\'] . ".ogg\'>OGG</a>
</p>";
}
add_shortcode( \'localvideo\', \'localvideo_func\' );
?>
这些功能有什么问题?