2012-06-05 42 views
0

對於我正在處理的客戶端網站,客戶希望能夠將某些自定義帖子類型與給定頁面關聯。我的主管已經指出我曾經做過類似事情的客戶的網站。他們使用Post Page Associator插件(似乎已經從插件列表中刪除)。Wordpress - Post Page Associator Issues

下面是我使用的插件的鏈接:我已經盡我所能來修改插件裏面的代碼來處理自定義文章類型我想用(其變動計入http://www.mediafire.com/?2dpbxac73rsn8l6

下載)。主要衝突來自於這一段代碼(從以前的客戶端的page.php文件文件)

<?php 
    $sidebar = new WP_Query($args); //queries for posts 
    $sidebar = wp_plugin_post_page_associator::get_associated_posts ($post->ID); //looks for associated posts via the plugin, the main offending line of code 
    if ($sidebar!="") : while ($sidebar->have_posts()) : $sidebar->the_post(); 
    ?> 
    <div id="sidebar-content"> <!-- sidebar area --> 
     <h1 class="blue-text"><?php the_title(); ?></h1> <!-- the title of the associated post --> 
     <div class="divider"></div> 
     <?php the_content(); ?> <!-- the content of the associated post--> 
     <br/><br/> 
    </div> 
    <?php endwhile; else:?> 

     <br/><br/> 
    <?php endif; ?> 

我在想,如果有一種方法來確定什麼樣的崗位類型相關聯的內容是這樣我就可以改變WP_Query相應的設置。如果我用$ sidebar註釋出第二行代碼,那麼所有帖子都會顯示在側邊欄中。有沒有解決這個問題,還是有更好的插件?

+0

對不起,也許這是我,但你可以更好地解釋什麼是你的主要的最終目標? –

+0

我希望能夠將自定義帖子類型與頁面相關聯(在編輯頁面屏幕上,我可以選擇與其關聯的自定義帖子類型的條目)。關聯的自定義帖子類型顯示在側邊欄區域的頁面上。 – Rosencruez

回答