如何删除附件领域,如description与alt在WordPress的附件的媒体库?
以下代码用于处理旧的Wordpress版本(3.5之前版本):
function remove_attachment_field ( $fields ) {
unset( $fields['image_alt'] ); // Removes ALT field
return $fields;
}
add_filter( 'attachment_fields_to_edit', 'remove_attachment_field', 15, 1 );
Run Code Online (Sandbox Code Playgroud)
但从那时起,我还没有找到一个有效的解决方案.
有人知道解决方案吗?
澄清我想删除哪些字段:

我一直看到关于此的各种报道.在某些答案中,人们声称他们已经在app store上批准了他们的webview应用程序(仅通过webview显示网站的简单应用程序).在其他一些答案中,他们说它被拒绝了.
这个的实际状态是什么?
我已经定制了我的Wordpress网站设计,使用特色图片非常过分.这就是为什么我需要要求非管理员发布的所有帖子都要求设置特色图像.
这怎么可能?
在我的WordPress网站中,我有一个自定义用户元数据reputation.该值为数字,与Stackoverflow中的点/信号使用方式类似.
我想要get用户为其他人排名的号码.
浏览数据库,我需要做的就是按降序列出表格,我可以看到谁排在1(有大多数点)等等......
有什么办法可以向用户显示排名吗?我猜最好的方法是按降序排序表,并以某种方式获取用户在该列表中的位置数量?
我想获取用户的排名.与下面的函数类似,获取用户的总评论数.我需要user_id作为参数:
function get_user_comments_count( $uid ){
global $wpdb;
$where = 'WHERE comment_approved = 1 AND user_id = ' . $uid ;
$comment_count = $wpdb->get_var("SELECT COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}");
return $comment_count;
}
Run Code Online (Sandbox Code Playgroud) 我想创建一个链接,将用户带到textarea并允许他们立即开始输入.这是我的textarea:
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
Run Code Online (Sandbox Code Playgroud)
目前,我只是链接到:
<a href="#commentnow">Post a comment</a>
Run Code Online (Sandbox Code Playgroud)
但这只会将它们带到textarea所在的区域,而不是它内部,以便它们可以开始输入.为了做到这一点,他们显然需要点击它.我用我当前的设置创造了一个小提琴.
我想可以有各种解决方案.然而,我会请求一个以兼容性为中心的解决方案(适用于所有浏览器,特别是手机浏览器).
在我的表单中,单击时隐藏“提交”按钮,并显示div显示submitting...。
这是非常基本的。参见jsfiddle。
jQuery代码是:
jQuery("#subnewtopicform").submit(function(e) {
// Hide button by button ID
jQuery("#subnewtopic").hide();
// Show hidden div
jQuery("#submitted").show();
});
Run Code Online (Sandbox Code Playgroud)
和HTML:
<form action="" method="post" id="subnewtopicform" />
Title:
<input type="text" name="title" /><br/>
<input type="submit" value="Submit Topic" class="button-primary" name="subnewtopic" id="subnewtopic" />
</form>
<div id="submitted" style="display:none">Submitting...</div>
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何使它在20秒后#subnewtopic再次显示并#subnewtopic隐藏(回到原来的状态)?
在我的Wordpress帖子页面中,我添加了第二个显示相关帖子的循环.此循环位于主循环内,显示帖子的内容.问题是添加第二个循环会弄乱页面上的所有内容.
评论来自不同的帖子,并且发表新评论会使您跳转到其他页面,依此类推.
显然,我还没有在主循环中正确插入第二个循环.
这是我的代码:
<div id="entries">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div class="entry post postpage clearfix">
<?php if (get_option('aggregate_integration_single_top') <> '' && get_option('aggregate_integrate_singletop_enable') == 'on') echo(get_option('aggregate_integration_single_top')); ?>
<h1 class="title"><?php the_title(); ?></h1>
<?php get_template_part('includes/postinfo','single'); ?>
<?php the_content(); ?>
<!-- START SECOND LOOP -->
<div class="radarcont">
<?php
$category = get_the_category();
$current_category = $category[0]->term_id;
$qarr = array(
'showposts' => '4',
'cat' => $current_category,
'tag' => 'pinned', // filtered tag
'post__not_in' => array(get_the_ID())
);
$q = new …Run Code Online (Sandbox Code Playgroud) 我的代码有问题.我很确定它与报价有关.让我来证明一下.
这很好用:
<?php if ( $is_latest_post ) echo '
hello world
'; ?>
Run Code Online (Sandbox Code Playgroud)
这不起作用:
<?php if ( $is_latest_post ) echo '
<a class="recent<?php $category = get_the_category(); echo $category[0]->category_nicename; ?>" href="<?php bloginfo('url'); ?>/<?php echo $category[0]->category_nicename; ?>"><?php echo $category[0]->cat_name; ?></a>
'; ?>
Run Code Online (Sandbox Code Playgroud)
为什么不起作用?我可以改变什么才能使它发挥作用?a class代码的一部分完全在if ( $is_latest_post )语句之外.感谢我刚开始用PHP学习编码.