Ver Mensaje Individual
  #7 (permalink)  
Antiguo 10/09/2007, 07:06
Avatar de _minimalnet_
_minimalnet_
 
Fecha de Ingreso: diciembre-2006
Ubicación: Valencia
Mensajes: 302
Antigüedad: 17 años, 4 meses
Puntos: 6
Re: Sidebars dinámicos

Como mi plantilla es enorme he simplificado lo que hay en la sidebar y he añadido espacios para que lo veas más claro.



/*================================= Esto que viene aquí es lo que venía por defecto en mi plantilla ================================= */

<hr />
<div id="sidebar-main" class="secondary">


<?php /* Menu for subpages of current page */
global $notfound;
if (is_page() and ($notfound != '1')) {
$current_page = $post->ID;
while($current_page) {
$page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$current_page = $page_query->post_parent;
}
$parent_id = $page_query->ID;
$parent_title = $page_query->post_title;

$page_menu = wp_list_pages('echo=0&sort_column=menu_order&title _li=&child_of='. $parent_id);
if ($page_menu) {
?>

<div class="sb-pagemenu">
<h2><?php echo $parent_title; ?> <?php _e('Subpages','k2_domain'); ?></h2>

<ul>
<?php echo $page_menu; ?>
</ul>

<?php if ($parent_id != $post->ID) { ?>
<a href="<?php echo get_permalink($parent_id); ?>"><?php printf(__('Back to %s','k2_domain'), $parent_title ) ?></a>
<?php } ?>
</div>
<?php } } ?>


<?php if (is_attachment()) { ?>
<div class="sb-pagemenu">
<a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php printf(__('Back to \'%s\'','k2_domain'), get_the_title($post->post_parent) ) ?></a>
</div>
<?php } ?>

<?php /* If there is a custom about message, use it on the frontpage. */ $k2about = get_option('k2aboutblurp'); if ((is_home() and $k2about != '') or !is_home() and !is_page() and !is_single() or is_paged()) { ?>

<div class="sb-about">
<h2><?php _e('About','k2_domain'); ?></h2>

<?php /* Frontpage */ if (is_home() and !is_paged()) { ?>
<p><?php echo stripslashes($k2about); ?></p>

<?php /* Category Archive */ } elseif (is_category()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the %2$s category.','k2_domain'), '<a href="' . get_settings('siteurl') .'">' . get_bloginfo('name') . '</a>', single_cat_title('', false) ) ?></p>

<?php /* Day Archive */ } elseif (is_day()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the day %2$s.','k2_domain'), '<a href="' . get_settings('siteurl') .'">' . get_bloginfo('name') . '</a>', get_the_time(__('l, F jS, Y','k2_domain'))) ?></p>

<?php /* Monthly Archive */ } elseif (is_month()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the month %2$s.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo( 'name').'</a>', get_the_time(__('F, Y','k2_domain'))) ?></p>

<?php /* Yearly Archive */ } elseif (is_year()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for the year %2$s.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo( 'name').'</a>', get_the_time('Y')) ?></p>

<?php /* Search */ } elseif (is_search()) { ?>
<p><?php printf(__('You have searched the %1$s weblog archives for \'<strong>%2$s</strong>\'.','k2_domain'),'<a href="'.get_settings('siteurl').'">'.get_bloginfo( 'name').'</a>', wp_specialchars($s)) ?></p>

<?php /* Author Archive */ } elseif (is_author()) { ?>
<p><?php printf(__('Archive for <strong>%s</strong>.','k2_domain'), get_the_author()) ?></p>
<p><?php the_author_description(); ?></p>

<?php } elseif (function_exists('is_tag') and is_tag()) { ?>
<p><?php printf(__('You are currently browsing the %1$s weblog archives for \'%2$s\' tag.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo( 'name').'</a>', get_query_var('tag') ) ?></p>

<?php /* Paged Archive */ } elseif (is_paged()) { ?>
<p><?php printf(__('You are currently browsing the %s weblog archives.','k2_domain'), '<a href="'.get_settings('siteurl').'">'.get_bloginfo( 'name').'</a>') ?></p>

<?php /* Permalink */ } elseif (is_single()) { ?>
<p><?php next_post('%', __('Next: ','k2_domain'),'yes') ?><br/>
<?php previous_post('%', __('Previous: ','k2_domain') ,'yes') ?></p>

<?php } ?>

<?php if (!is_home() and !is_paged() and !in_category($k2asidescategory) or is_day() or is_month() or is_year() or is_author() or is_search() or (function_exists('is_tag') and is_tag())) { ?>
<?php } ?>
</div>

<?php } ?>

/*================================= Hasta aquí es lo que venía por defecto, ahora añado lo de los condicionales ================================= */













<?php if (is_single()) { ?>


<h2>About this <span class="a">entry</span></h2>
This entry was posted <?php /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> and is filed under <?php the_category(', ') ?> category.
<br><br>
You can follow any responses to this entry through the <a href="<?php echo get_permalink(); ?>feed/" target="_blank">RSS 2.0</a> feed.

<?php } ?>


































<?php if (is_home()) { ?>

<h2>About <span class="a">MinimalNet</span></h2>
A netlabel is a online label that distributes its music by Internet in digital format and in a <u>free way</u> and MinimalNet is a personal blog where I select the best netlabel dance releases.

<br>

<h2>Most Commented <span class="a">Posts</span></h2>
<ul><?php get_mostcommented(); ?></ul>

<br>
<h2>Blog <span class="a">Stats</span></h2>
<?php GeneralStatsComplete(); ?>

<?php } ?>














<?php if (is_page()) { ?>

<div id="height10pxall"></div>

<div id="search"><h2><?php _e('Search','k2_domain'); ?></h2><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>

<br>

<h2>About <span class="a">MinimalNet</span></h2>
A netlabel is a online label that distributes its music by Internet in digital format and in a <u>free way</u> and MinimalNet is a personal blog where I select the best netlabel dance releases.

<br>

<div id="recent_comment"><h2>Recent <span class="a">Comments</span></h2> <ul><?php get_recent_comments(); ?></ul></div>

<?php } ?>


















<?php if (is_search()) { ?>

<div id="height10pxall"></div>

<div id="search"><h2><?php _e('Search','k2_domain'); ?></h2><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>

<br>

<h2>About <span class="a">MinimalNet</span></h2>
A netlabel is a online label that distributes its music by Internet in digital format and in a <u>free way</u> and MinimalNet is a personal blog where I select the best netlabel dance releases.
<br><br>
You can add this <a href="http://feeds.feedburner.com/minimalnet" target="_blank">feed</a> to your rss reader or subscribe to the <a href="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1097042&loc=en_US" target="_blank">newsletter</a> and receive the news daily in your email.
<br><br>
For more info read the <a href="http://www.minimalnet.org/faq">FAQ</a> section.


<h2>Recent <span class="a">Post</span></h2>
<ul><?php recent_posts(); ?></ul>

<br>

<div id="recent_comment"><h2>Recent <span class="a">Comments</span></h2> <ul><?php get_recent_comments(); ?></ul></div>

<br>

<h2>Archives <span class="a">Last 8 months</span></h2>
<ul>
<?php wp_get_archives('type=monthly&limit=8'); ?>
</ul>

<?php } ?>



















<?php if (is_archive()) { ?>

<div id="height10pxall"></div>

<div id="search"><h2><?php _e('Search','k2_domain'); ?></h2><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>

<br>

<h2>About <span class="a">MinimalNet</span></h2>
A netlabel is a online label that distributes its music by Internet in digital format and in a <u>free way</u> and MinimalNet is a personal blog where I select the best netlabel dance releases.
<br><br>
You can add this <a href="http://feeds.feedburner.com/minimalnet" target="_blank">feed</a> to your rss reader or subscribe to the <a href="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1097042&loc=en_US" target="_blank">newsletter</a> and receive the news daily in your email.
<br><br>
For more info read the <a href="http://www.minimalnet.org/faq">FAQ</a> section.

<br>

<h2>Recent <span class="a">Post</span></h2>
<ul><?php recent_posts(); ?></ul>

<br>

<div id="recent_comment"><h2>Recent <span class="a">Comments</span></h2> <ul><?php get_recent_comments(); ?></ul></div>

<br>

<h2>Archives <span class="a">Last 8 months</span></h2>
<ul>
<?php wp_get_archives('type=monthly&limit=8'); ?>
</ul>

<?php } ?>


















<?php if (is_404()) { ?>

<img src="http://www.minimalnet.org/wp-content/themes/jstheme/images/ICO_FEED2.gif" hspace="0" vspace="0" border="0" align="absmiddle" title="">&nbsp;&nbsp;MinimalNet has changed the feed url, update your rss to this new link <a href="http://feeds.feedburner.com/minimalnet" target="_blank">http://feeds.feedburner.com/minimalnet</a>

<div id="height10pxall"></div>

<div id="search"><h2><?php _e('Search','k2_domain'); ?></h2><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>

<?php } ?>






/*================================= Esto que viene ahora como está fuera de los "if" sale en todas las sidebar ================================= */








<br>

<div id="meta_rss">
<span class="s1">RSS: </span>
<span class="s1">
<a href="http://feeds.feedburner.com/minimalnet" target="_blank">Entries</a>
<a href="http://feeds.feedburner.com/minimalnet-comments" target="_blank">Comments</a>
<a href="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1097042&loc=en_US" target="_blank">Newsletter</a>
</span>
</div>



</div> <!-- #sidebar-main -->

<div class="clear"></div>
__________________
mi blog --> www.minimalnet.org

Última edición por _minimalnet_; 10/09/2007 a las 07:15