Nieuw lid |
|
Hoi,
ik ben bezig met het bewerken van een wordpress script. Nu heb ik na lang zoeken een script gevonden dat ik wil gebruiken voor een menu. Het menu wil ik gewoon staand, als een lijst, zonder drops of outs. Helaas krijg ik het niet voor elkaar (ik krijg de de lege ruimte maar niet weg waar normaal de bullet staat) Wie kan mij misschien op weg helpen en een css sciptje geven waar iig dat in staat. Het script van de list-functie staat hieronder.
<div id="navigatie">
<?php
// is there a page or category? both may have childeren
if( is_category() ) {
// if this category has childeren
$categ_object = get_category( get_query_var( 'cat' ), false );
$list_subcats = wp_list_categories( 'title_li=&depth=1&echo=0&child_of=' . (int)$categ_object->cat_ID );
// wordpress never returns null or empty string. If children, <a> tag will be found, otherwise string is returned.
preg_match_all( '|<a.*?href=[\'"](.*?)[\'"].*?>|i', $list_subcats, $m );
if( !$m[ 1 ] ) {
// there are no subcategories. Why?
// this is either the last child or this category really doesn't have subcategories
// last child must have a parent, right?
if( (int)$categ_object->category_parent > 0 ) {
// we'll need parent category name for the title, extract name via category ID
$parent_cat_name = $wpdb->get_var( "SELECT name FROM $wpdb->terms WHERE term_id=" . (int)$categ_object->category_parent );
?>
<div class="box">
<h3><?php echo $parent_cat_name; ?></h3>
<ul class="subnavigation">
<?php wp_list_categories( 'title_li=&depth=1&child_of=' . (int)$categ_object->category_parent ); ?>
</ul>
</div>
<?php
} // else...no else! This category really doesn't have child categories.
} else {
// ohoho! ...but here are some. List them all...
?>
<div class="box">
<h3><?php echo $categ_object->cat_name; ?></h3>
<ul class="subnavigation">
<?php wp_list_categories( 'title_li=&depth=1&child_of=' . (int)$categ_object->cat_ID ); ?>
</ul>
</div>
<?php
}
}
// almost the same for page hierarchy.
if( is_page() ) {
// here we go...just do the same job
$page_object = get_post( get_query_var( 'page' ), OBJECT );
$list_subpages = wp_list_pages( 'title_li=&depth=1&echo=0&child_of=' . (int)$page_object->ID );
// wordpress never returns null or empty string. If children, <a> tag will be found, otherwise string is returned.
preg_match_all( '|<a.*?href=[\'"](.*?)[\'"].*?>|i', $list_subpages, $ms );
if( !$ms[ 1 ] ) {
if( (int)$page_object->post_parent > 0 ) {
$parent_post_name = $wpdb->get_var( "SELECT post_title FROM $wpdb->posts WHERE ID=" . (int)$page_object->post_parent );
?>
<div class="box">
<h3><?php echo $parent_post_name; ?></h3>
<ul class="subnavigation">
<?php wp_list_pages( 'title_li=&depth=1&child_of=' . (int)$page_object->post_parent ); ?>
</ul>
</div>
<?php
}
} else {
?>
<div class="box">
<h3><?php echo $page_object->post_title; ?></h3>
<ul class="subnavigation">
<?php wp_list_pages( 'title_li=&depth=1&child_of=' . (int)$page_object->ID ); ?>
</ul>
</div>
<?php
}
}
?>
</div>
<div id="navigatie"> <?php // is there a page or category? both may have childeren if( is_category() ) { // if this category has childeren $categ_object = get_category( get_query_var( 'cat' ), false ); $list_subcats = wp_list_categories( 'title_li=&depth=1&echo=0&child_of=' . (int)$categ_object->cat_ID ); // wordpress never returns null or empty string. If children, <a> tag will be found, otherwise string is returned. preg_match_all( '|<a.*?href=[\'"](.*?)[\'"].*?>|i ', $list_subcats, $m ); if( !$m[ 1 ] ) { // there are no subcategories. Why? // this is either the last child or this category really doesn't have subcategories // last child must have a parent, right? if( (int)$categ_object->category_parent > 0 ) { // we'll need parent category name for the title, extract name via category ID $parent_cat_name = $wpdb->get_var( "SELECT name FROM $wpdb->terms WHERE term_id=" . (int)$categ_object->category_parent ); ?> <div class="box"> <h3> <?php echo $parent_cat_name; ?></h3> <ul class="subnavigation"> <?php wp_list_categories( 'title_li=&depth=1&child_of=' . (int)$categ_object->category_parent ); ?> </ul> </div> <?php } // else...no else! This category really doesn't have child categories. } else { // ohoho! ...but here are some. List them all... ?> <div class="box"> <h3 ><?php echo $categ_object->cat_name; ? ></h3 > <ul class="subnavigation"> <?php wp_list_categories( 'title_li=&depth=1&child_of=' . (int)$categ_object->cat_ID ); ?> </ul> </div> <?php } } // almost the same for page hierarchy. if( is_page() ) { // here we go...just do the same job $page_object = get_post( get_query_var( 'page' ), OBJECT ); $list_subpages = wp_list_pages( 'title_li=&depth=1&echo=0&child_of=' . (int)$page_object->ID ); // wordpress never returns null or empty string. If children, <a> tag will be found, otherwise string is returned. preg_match_all( '|<a.*?href=[\'"](.*?)[\'"].*?>|i ', $list_subpages, $ms ); if( !$ms[ 1 ] ) { if( (int)$page_object->post_parent > 0 ) { $parent_post_name = $wpdb->get_var( "SELECT post_title FROM $wpdb->posts WHERE ID=" . (int)$page_object->post_parent ); ?> <div class="box"> <h3> <?php echo $parent_post_name; ?></h3> <ul class="subnavigation"> <?php wp_list_pages( 'title_li=&depth=1&child_of=' . (int)$page_object->post_parent ); ?> </ul> </div> <?php } } else { ?> <div class="box"> <h3> <?php echo $page_object->post_title; ?></h3> <ul class="subnavigation"> <?php wp_list_pages( 'title_li=&depth=1&child_of=' . (int)$page_object->ID ); ?> </ul> </div> <?php } } ?> </div>
|