Hallo, ich möchte auf einer statischen Startseite meine letzten Beiträge einbinden.
Habe es soweit hinbekommen jedoch fehlen die Beitragsbilder sowie der Auszugstext. Die zu sehenden orangen Grafiken sind normalerweise auch nicht vorhanden. Die Verlinkung und die Anzahl der ausgegebenen Beiträge stimmt jedoch. (siehe Bild)
Hier der Code von der index.php
PHP
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Dyad
*/
get_header(); ?>
<main id="primary" class="content-area" role="main">
<?php if ( have_posts() ) : ?>
<div id="posts" class="posts">
<?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( 'template-parts/content', 'blocks' );
?>
<?php endwhile; ?>
</div><!-- .posts -->
<?php the_posts_navigation(); ?>
<?php else : ?>
<div id="posts" class="posts">
<?php get_template_part( 'template-parts/content', 'none' ); ?>
</div>
<?php endif; ?>
</main><!-- #main -->
<?php get_footer(); ?>
Alles anzeigen
Hier der Code von der page.php
PHP
<?php
/**
* The template for displaying all single posts.
*
* @package Dyad
*/
get_header(); ?>
<main id="primary" class="content-area" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content', 'page' ); ?>
<?php endwhile; // End of the loop. ?>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</main><!-- #main -->
<?php get_footer(); ?>
Alles anzeigen
Und hier mein Code vom Template welches ich der Startseite zugewiesen habe:
PHP
<?php /*
Template Name: landing-apge
*/ ?>
<?php
/**
* The template for Custom Landing Page.
*
* @package Dyad
*/
get_header(); ?>
<main id="primary" class="content-area" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content', 'page' ); ?>
<?php endwhile; // End of the loop. ?>
<?php query_posts('showposts=5'); ?>
<div id="posts" class="posts">
<?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( 'template-parts/content', 'blocks' );
?>
<?php endwhile;?>
</div>
</main><!-- #main -->
<?php get_footer(); ?>
Alles anzeigen
Hoffe ihr könnt mir helfen.
LG Kris