Guest User

mod_list2

a guest
Oct 23rd, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. <?php
  2. /**
  3.  *
  4.  * Template Name: mod_list2
  5.  * The template displays the Headline & Content of the Page and aftwerwards all Posts of the Category, which is chosen in the costum field 'newstopic'
  6.  * New on vers.2: Limit the number of posts by chose the costum field 'anzahlposts'
  7.  *
  8.  * @package WordPress
  9.  * @subpackage STTF
  10.  * @since STTF 1.0
  11.  */
  12.  
  13. get_header();
  14. ?>
  15.  
  16. <div id="container">
  17.     <div id="content" role="main">
  18.         <?php if ( have_posts() ) while ( have_posts() ) : the_post();
  19.         ?><div id="start">
  20.         <div class="title"><h2><?php the_title();?></h2></div>
  21.         <?php the_content();?>
  22.         </div>
  23.         <?php endwhile;?>
  24.         <div id="news">
  25.             <div class="entry-title">
  26.                 <h3>News</h3>
  27.             </div>
  28.             <?php $newstopic = get_post_meta($posts[0]->ID, 'newstopic', true);
  29.  
  30. if ($newstopic) : //der zweite loop wird nur verwendet wenn das benutzerfeld ausgefuellt ist//
  31.  
  32. $cat = get_cat_ID($newstopic);
  33. $cat_slug = get_category($cat)->slug;
  34.             ?>
  35. <?php query_posts('posts_per_page=6&category_name=' . $cat_slug); ?>
  36. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  37.            
  38.    
  39.             <div class="newswrapper"><!-- wrapper -->
  40.             <div id="post-<?php the_ID();?>" <?php post_class();?>>
  41.                 <h2 class="entry-content-title"><a href="<?php the_permalink() ?>"><?php the_title();?></a></h2>
  42.                 <div class="entry-content">
  43.                     <?php $teaser = get_post_custom_values('teaser');?>
  44.                     <?php if(!(empty($teaser))) { ?><?php echo $teaser[0];?><?php }?>
  45.                     <a href="<?php the_permalink() ?>"> Mehr erfahren &raquo;</a>
  46.                 </div><!-- .entry-content -->
  47.             </div><!-- #post-## -->
  48.             </div><!-- wrapper ende -->
  49.             <?php endwhile;?>
  50.             <?php wp_reset_query();
  51.                 //NEU
  52.             ?>
  53.             <?php endif; //ende vom if ($category) : bereich// ?>
  54.         </div><!--#news -->
  55.     </div><!-- #content -->
  56. </div><!-- #container -->
  57. <?php get_sidebar();?>
  58. <?php get_footer();?>
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment