Hallo Leute,
ich möchte gerne auf der Main Index Page das erste Bild aus dem Post anzeigen.
Meine Main Page hat noch zusätzlich eine Template page. Nun weiß ich nicht, wo ich diesen Code:
PHP
<a href="<?php the_permalink(); ?>" tilte="<?php the_title(); ?>">
<img src="<?php echo catch_that_image(); ?>" alt="<?php the_title(); ?>" width="165px" height="124px" />
</a>
einsetzen muss, damit das Bild auf der Main angezeigt wird.
Hier mal die Main Page:
PHP
<?php get_header(); ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<?php if ( have_posts() ) : ?>
<?php $i=0; $postCount = 0; while (have_posts()) : the_post(); $i++; $postCount++; ?>
<?php if($i==1){echo'<div class="row">';} ?>
<?php get_template_part( 'preview', get_post_format() ); ?>
<?php if($i==6 || $postCount == sizeof($posts)){$i=0;echo'</div>';} ?>
<?php endwhile; ?>
<?php if ( function_exists( 'wp_paginate' ) ) : wp_paginate(); else : ?>
<ul class="pager">
<li class="previous">
<?php previous_posts_link() ?>
</li>
<li class="next">
<?php next_posts_link() ?>
</li>
</ul>
<?php endif; ?>
<?php else : ?>
<header class="entry-header">
<h1 class="entry-title">Nothing Found</h1>
</header>
<div class="entry-content">
<p>Apologies, but no results were found. Perhaps searching will help find a related post.</p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
<?php endif; // end have_posts() check ?>
</div><!-- .col-md-12 -->
</div><!-- .row -->
<?php get_sidebar(); ?>
</div><!-- .container -->
<?php get_footer(); ?>
Alles anzeigen
Und hier noch die Template Page für die Main:
PHP
<?php get_header(); ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2><?php the_title(); ?></h2>
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- .col-md-9 -->
</div><!-- .row -->
<?php get_sidebar(); ?>
</div><!-- .container -->
<?php get_footer(); ?>
Alles anzeigen
Ich hoffe ihr könnt mir weiterhelfen.
Danke schonmal
hackbird