2015-06-10 43 views
1

在網站主頁上,有一個包含兩個最新博客帖子的網格部分。我需要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 --> 

所以p.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')); 
}); 
} 

}); 
+0

在PHP文件只需重新排序文件。 –

回答

1

有沒有必要使用JavaScript來做到這一點。

只需編輯模板和發佈日期前移到

來。

編輯:

打開在WP管理區您的主頁,並記下它使用的模板名稱。

然後搜索你的模板文件在你的主題文件夾,它應該出現這樣的名字:

<?php 
/* 
    Template Name: Homepage 
*/ 
?> 

這將是你需要修改

+0

感謝您的幫助。我很困惑如何移動它,但是。我發現'the_excerpt'的唯一地方是在functions.php和custom_functions.php中。在functions.php中: 'if('on'=== $ show_content){ global $ more; $ more = null; the_content(__('read more ...','Divi')); \t}否則{ \t如果(has_excerpt()){ \t \t the_excerpt(); \t \t} else { \t \t truncate_post(270); \t \t}' 在custom_functions.php: '的add_filter( 'the_excerpt', 'do_shortcode');'和 '$ post_excerpt = ''; \t \t $ post_excerpt = apply_filters('the_excerpt',$ post-> post_excerpt);' 我只是不確定如何重新排列? – laustewa14

+0

看到編輯回答 – andrew

+0

好吧,我找到了正確的文件,並將其移動工作..但這裏是我的問題現在:我有一個孩子的主題,不想改變我的父母functions.php文件中的任何東西。我一直在試圖將標題所在的特定部分複製並粘貼到子項functions.php中並在其中進行編輯,但它會導致空白屏幕。我不確定我做錯了什麼。 – laustewa14