2015-06-30 39 views
1

我是新來php編碼,我需要修復我的朋友的網站中的錯誤。這裏是錯誤http://www.corectura.ro/category/in-presa/(這是羅馬尼亞語,但沒關係)的頁面。 「Citeste mai multe ...」是「Read more ...」鏈接,它不起作用。它只是在新標籤中打開相同的頁面(這一個:http://www.corectura.ro/category/in-presa/),而不是打開鏈接/帖子以讀取更多,就像「read more ...」按鈕所說的那樣。該網站在Wordpress平臺上,並具有自定義主題。「更多」WordPress的自定義主題中的按鈕錯誤

我已經查看了所有php文件中的「read more」部分提到的編輯器。我只在archive.php和styles.css中找到它。

在樣式表中唯一的代碼,我發現這是一個(關於向更多鏈接)

.r_more{ display:block; text-align:right; } 

而且在archive.php下面的代碼:

<li> 
    <div class="post_thumbnail"><?php the_post_thumbnail('thumbnail'); ?></div> 
    <div class="post_content"><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> 
     <div class="date_post"><?php echo ucfirst(get_the_date('F Y')); ?></div> 
     <?php the_excerpt(); 

      echo '<a href="'.the_permalink().'" class="r_more" target="_blank">Citeşte mai multe...</a>'; 

     ?> 
    </div> 
</li> 

有這段代碼有問題嗎?語法是否正確?爲什麼它會在新標籤中打開同一頁面,而不是打開頁面,點擊「Citeste mai multe ...」(「Read more ...」)後需要顯示的內容?

請幫忙。謝謝。

回答

4

您使用echo,所以你需要改變the_permalink()get_permalink()(其中return S中的永久鏈接):

echo '<a href="'.get_permalink().'" class="r_more" target="_blank">Citeşte mai multe...</a>'; 
+0

非常感謝你。我按照你的說法改變了代碼,它的工作原理應該如此。 – ibcoderioana

+0

不客氣。請點擊綠色複選標記選擇答案。 – rnevius

0

試試這個:

<?php the_excerpt(); ?> 
<a href="<?php the_permalink(); ?>" class="r_more" target="_blank">Citeşte mai multe...</a>