2012-09-22 36 views
0

我正在尋找解決方案約4小時,我不能(不想)在這個特定的問題沒有更多的時間投入。 我的問題是我想讓wordpress完全正常工作。 (幾乎)一切都很好:我可以顯示所有帖子或只顯示一個定義的數字,但我不知道如何只顯示用戶點擊的帖子(在標題或閱讀更多) $ _GET-顯示的數據是'p'=>,它顯示後ID(例如35,11,等等)。WordPress的:當點擊標題時自動顯示只有一個職位

這裏有一個快速示例:(我學習了一部分,我沒有弄清楚)

echo $_GET['p'].'<br>'; 
       if(!isset($_GET['p'])) : 
        $myposts = get_posts(); 
       else : 
        $args = array('numberposts' => 1, 'offset'=> $_GET["p"]); 
        $myposts = query_posts($args); 
       endif; 
       $index = 0; 
       foreach($myposts as $post) : 
        setup_postdata($post); 
        ?> 
        <div class="article"> 
         <p class="title"> 
          <?php the_title(); ?> 
         </p> 
         <span class="date-block"> 
          <p class="day"><?php the_time('j'); ?></p> 
          <p class="year"><?php the_time('Y'); ?></p>    
          <p class="month"><?php the_time('F'); ?></p> 
         </span> 
         <p> 
          <?php the_content(); ?> 
         </p> 
        </div> 
       <?php 
        endforeach; wp_reset_postdata(); 
       ?>  

請幫助我,我想我給你所有需要的信息。 謝謝!

回答

0

最後,我得到它的工作: 這其實很簡單(總是它很難找出..) 對於有同樣的問題別人,這裏的解決方案:

$post_id = $_GET['p']; 
$queried_post = get_post($post_id); 
the_title(); 
echo $queried_post->post_content; 
$posttags = get_the_tags($post_id); 
if ($posttags) 
foreach($posttags as $tag) 
echo $tag->name; 
+0

請不要在包括簽名的帖子;特別是那些包含自我宣傳鏈接的網站。你可能會把這種事情放在你的個人資料中。 –

相關問題