我需要爲每個li類添加相同的圖標,這些圖標是由Im腳本在WordPress自定義小部件中使用的一個PHP腳本自動生成的。PHP:將html圖標添加到腳本
這是我在一個wordpress小部件中使用的腳本來顯示一些子頁面。
<?php
$ancestor_id=24;
$descendants = get_pages(array('child_of' => $ancestor_id));
$incl = "";
foreach ($descendants as $page) {
if (($page->post_parent == $ancestor_id) ||
($page->post_parent == $post->post_parent) ||
($page->post_parent == $post->ID))
{
$incl .= $page->ID . ",";
}
}?>
<ul>
<?php wp_list_pages(array(
"child_of" => $ancestor_id,
"include" => $incl,
"link_before" => "",
"title_li" => "",
"sort_column" => "menu_order"));?>
</ul>
的圖標(已一類asigned),我需要使用的代碼..
<img class='sideicons' src="http://accountabletest.com/wp-content/uploads/2013/12/iconSidebar1.jpg" alt="" >
如何使生成包括相同的圖標每個<li>
?
與CSS就解決了。無論如何謝謝你@kcdwayne – Gonpires