在网站主页上,有一个网格部分,上面有两个最新的博客帖子。我需要Javascript将日期移动到每个块的底部(边界外)。链接是:http://abundancepractice-building.flywheelsites.com
结构如下:
<div class="et_pb_column et_pb_column_4_4">
<div class="et_pb_blog_grid_wrapper">
<div class="et_pb_blog_grid clearfix et_pb_bg_layout_light blog-section" style="position: relative; height: 400px;">
<article id="post-226" class="et_pb_post et_pb_no_thumb post-226 post type-post status-publish format-standard hentry category-uncategorized" style="position: absolute; left: 0px; top: 0px;">
<h2><a href="http://abundancepractice-building.flywheelsites.com/what-you-learned-in-grad-school-is-ruining-your-website-and-10-ways-to-fix-it/">What You Learned In Grad School is Ruining Your Website (and 10 ways to fix it)</a></h2>
<p class="post-meta"> Jun 5, 2015 </p>Blog excerpt text...
</article> <!-- .et_pb_post -->因此,每个块的后置元都需要连接到块的底部。我不是Javascript专家,但我到目前为止尝试了以下几点:
jQuery(function($){
$( ".post-meta:nth-child(1)" ).appendTo(".et_pb_post.et_pb_no_thumb:nth- child(1)");
$( ".post-meta:nth-child(2)" ).appendTo(".et_pb_post.et_pb_no_thumb:nth-child(2)");
});和
jQuery(function($){
if ($('body').hasClass('et_pb_blog_grid')) {
$('.et_pb_post p')
.each(function() {
var n = jQuery(this).find(".post-meta").html();
$(n).clone().insertAfter(jQuery(this).find('.et_pb_post.et_pb_no_thumb'));
});
}
});发布于 2015-06-10 17:48:03
没有必要使用javascript来做到这一点。
只需编辑模板并移动
<?php the_excerpt(); ?> 在投递日期之前。
编辑:
打开wp管理区域中的主页,并记下它使用的模板名。
然后,在“主题”文件夹中搜索模板文件中应该显示的名称:
<?php
/*
Template Name: Homepage
*/
?>这将是您需要修改的文件。
https://stackoverflow.com/questions/30763549
复制相似问题