我在自定义设计中实现了Wordpress(从头开始),并且我在使用functions.php文件时遇到了一些问题。
我没有在我的网站上添加任何当前使用MAMP在本地托管的插件。
代码分为三部分:一部分用于创建自定义缩略图大小,另一部分用于修复媒体库错误,另一部分用于创建3个不同的侧边栏小部件。
我添加了前两个部分(缩略图+媒体库),一切正常,但在添加最后一部分(侧边栏)后,媒体库再次无效。删除侧栏代码时,媒体库将再次运行。所以这三个部分正在以某种方式干扰和抵消。 我很确定我的错误是语法......这是完整的代码:
<?php
// Add custom size of thumbnails
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true ); // default Post Thumbnail dimensions (cropped)
add_image_size( 'another-size', 600, 400 ); // Not Cropped (additional sizes) size doesn't matter because we're adding "full"
}
// Fixes Media Library error (without this it's not possible to add images or manage it – it just appears empty)
function ms_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'ms_image_editor_default_to_gd' );
?>
<?php
// Created three different sidebars and allows user to edit their content as widgets
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'column 1',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'column 2',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'column 3',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
}?>
答案 0 :(得分:0)
试试这个,也许你应该只使用一个5:16 PM
部分
Private Sub Worksheet_Change(ByVal Target As Range)
Dim trail As String, v As String
With Target
If Intersect(Range("A:A"), Target) Is Nothing Then Exit Sub
If .Value = "" Then
Application.EnableEvents = False
.Clear
Application.EnableEvents = True
Exit Sub
End If
trail = Right(CStr(Now()), 2)
v = .Text
mins = Right(v, 2)
hrs = Mid(v, 1, Len(v) - 2)
If trail = "PM" Then hrs = hrs + 12
Application.EnableEvents = False
.Clear
.Value = TimeSerial(hrs, mins, 0)
.NumberFormat = "[$-en-US]h:mm AM/PM;@"
Application.EnableEvents = True
End With
End Sub