سلام
اين كد توي فايل functions.php هست كه مشخص ميكنه ترتيب برگه ها بر اساس حروف الفبا نشون داده بشه:
function art_list_pages_filter($output)
{
$output = preg_replace('~<li([^>]*)><a([^>]*)>([^<]*)</a>~',
'<li$1><a$2><span><span>$3</span></span></a>',
$output);
$re = '~<li class="([^"]*)(?: current_page_(?:ancestor|item|parent))+([^"]*)"><a ~';
$output = preg_replace($re, '<li class="$1$2"><a class="active" ', $output, 1);
$output = preg_replace($re, '<li class="$1$2"><a ', $output);
return $output;
}
function art_header_page_list_filter($pages)
{
global $artThemeSettings;
$result = array();
if ($artThemeSettings['menu.showSubmenus']) {
foreach ($pages as $page)
$result[] = $page;
} else {
foreach ($pages as $page)
if (0 == $page->post_parent)
$result[] = $page;
}
if ('page' == get_option('show_on_front')) {
$pageOnFront = get_option('page_on_front');
$pageForPosts = get_option('page_for_posts');
if ($pageOnFront) {
foreach ($result as $key => $page) {
if (0 == $page->post_parent && $pageOnFront == $page->ID) {
unset($result[$key]);
break;
}
}
}
if (!$pageOnFront && $pageForPosts) {
foreach ($result as $key => $page) {
if (0 == $page->post_parent && $pageForPosts == $page->ID) {
unset($result[$key]);
break;
}
}
}
}
return $result;
}
function art_menu_items()
{
$homeMenuItemCaption = <<<EOD
Home
EOD;
$showHomeMenuItem = true;
$isHomeSelected = null;
if ('page' == get_option('show_on_front')) {
$pageOnFront = get_option('page_on_front');
$pageForPosts = get_option('page_for_posts');
if ($pageOnFront) {
$page = & get_post($pageOnFront);
if (null != $page)
$homeMenuItemCaption = apply_filters('the_title', $page->post_title);
$isHomeSelected = is_page($page->ID);
} elseif (!$pageOnFront && $pageForPosts) {
$page = & get_post($pageForPosts);
if (null != $page)
$homeMenuItemCaption = apply_filters('the_title', $page->post_title);
}
}
if (null === $isHomeSelected)
$isHomeSelected = is_home();
if (true === $showHomeMenuItem || 'page' == get_option('show_on_front'))
echo '<li><a' . ($isHomeSelected ? ' class="active"' : '') . ' href="' . get_option('home') . '"><span><span>'
. $homeMenuItemCaption . '</span></span></a></li>';
add_action('get_pages', 'art_header_page_list_filter');
add_action('wp_list_pages', 'art_list_pages_filter');
wp_list_pages('title_li=');
remove_action('wp_list_pages', 'art_list_pages_filter');
remove_action('get_pages', 'art_header_page_list_filter');
}
add_filter('comments_template', 'legacy_comments');
function legacy_comments($file) {
if(!function_exists('wp_list_comments')) : // WP 2.7-only check
$file = TEMPLATEPATH.'/legacy.comments.php';
endif;
return $file;
}
ميخواستم بر اساس چيدمان باشه و فكر كنم مشكلش توي اين فايل باشه