Thumbnails Archive

  • Ich habe die letzten Tage vergeblich versucht Thumbnails auf meine Archivseiten einzubinden. Da ich der Kodierung nicht mächtig bin, habe ich es mit Plugins versucht ... ohne Erfolg. Heute habe ich dann eine Code in die Archiv.php eingefügt und tatsächlich erschien ein kleines Bild ... leider aber nur jeweils zum ersten Beitrag.

    Zumindest habe ich die Hoffnung auf dem richtige weg zu sein.

    Adresse: http://www.jernrive.de

    Eingefügter Code:

    PHP
    <?php if ( has_post_thumbnail()) : ?>   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       <?php the_post_thumbnail(thumbnail, array('class' => 'alignleft')); ?>
       </a> 
    <?php endif; ?>


    Die Archive.php


    PHP
    <?php/** * Archive template file * * @package Atout * @author Frenchtastic.eu */get_header();if(get_option('atout_page_layout_opt') == 'left'):    $atout_sidebar_float = '';    $atout_md = 9;    $atout_sm = 8;    $atout_sp = 'content-right';elseif(get_option('atout_page_layout_opt') == 'full_width'):    $atout_sidebar_float = 'hide';    $atout_md = 12;    $atout_sm = 12;    $atout_sp = 'full-width';else:    $atout_sidebar_float = '';    $atout_md = 9;    $atout_sm = 8;    $atout_sp = 'content-left';endif; ?>
    <div class="container">    <div class="row">        <main class="col-md-<?php echo $atout_md; ?> col-sm-<?php echo $atout_sm; ?> <?php echo $atout_sp; ?>">            <div class="searchpage">                <header class="search-header">                    <h3 class="headtitle"><?php echo __('Archives', 'atout'); ?></h3>                    <?php get_search_form(); ?>                </header><!-- .page-header -->                                                            <?php if ( have_posts() ) : ?>                                                <?php if ( has_post_thumbnail()) : ?>   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >   <?php the_post_thumbnail(thumbnail, array('class' => 'alignleft')); ?>   </a><?php endif; ?>
                    <?php /* Start the Loop */ ?>                                <?php while ( have_posts() ) : the_post(); ?>   
    <?php/* Include the Post-Format-specific template for the content.* If you want to override this in a child theme, then include a file* called content-___.php (where ___ is the Post Format name) and that will be used instead.*/get_template_part( 'content', get_post_format() );?>
    <?php endwhile; ?>                                                    
                    <?php else : ?>
                    <h5 class="alert alert-grey"><?php echo __('Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'atout'); ?></h5>
                    <?php endif; ?>            </div>            <?php atout_paging_nav(); ?>        </main>        <aside class="sidebar col-md-3 col-sm-4 col-xs-12 <?php echo $atout_sidebar_float; ?>">            <?php dynamic_sidebar(); ?>        </aside>    </div></div>
    <?php get_footer(); ?>
    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • setze deinen Code nach dem Start des Loops:
    <?php while ( have_posts() ) : the_post(); ?>...hier dein Code

    [size=10]Bitte immer zuerst die Forensuche nutzen und erst danach Deine Fragen hier im Forum stellen, denn sehr vieles wurde schon mehrfach beantwortet. Bitte dabei auch die Forenregeln beachten.
    Kein Support per PN - Fragen gehören ins Forum.[/SIZE]
    [size=8]Wenn du eine weise Antwort verlangst, musst du vernünftig fragen. (Johann Wolfgang von Goethe)[/SIZE]

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!