it-swarm.com.de

Benutzerdefiniertes Thema Blog-Seite zeigt keine Beiträge

Ich entwickle mein benutzerdefiniertes Thema in WordPress von Grund auf neu. Jetzt, wenn ich mit meiner Blog-Seite arbeite, werden keine Beiträge angezeigt. Ich habe meine "index.php" -Seite geändert, aber ich denke, es muss eine Funktion auf meiner "functions.php" -Seite geben, aufgrund derer meine Beiträge fehlen werden nicht angezeigt. Ich habe viel danach gesucht, aber keine guten Lösungen gefunden. Bitte sag mir, was ich tun kann.
das ist meine index.php Seite:

<?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: {@link https://codex.wordpress.org/Template_Hierarchy}
 *
 * @package WordPress
 * @subpackage customtheme
 * @since 2016
 */

get_header(); ?>

    <div class="fullContainer">
            <div class="innerContainer2">



        <?php if ( have_posts() ) : ?>

            <?php if ( is_home() && ! is_front_page() ) : ?>
                <header>
                    <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
                </header>
            <?php endif; ?>

            <?php
            // Start the loop.
//                        var_dump(the_post());
//                        exit;
            while ( have_posts() ) : the_post();

                /*
                 * 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() );

            // End the loop.
            endwhile;

            // Previous/next page navigation.
            the_posts_pagination( array(
                'prev_text'          => __( 'Previous page', 'customtheme' ),
                'next_text'          => __( 'Next page', 'customtheme' ),
                'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'customtheme' ) . ' </span>',
            ) );

        // If no content, include the "No posts found" template.
        else :
            get_template_part( 'content', 'none' );

        endif;
        ?>

         </div>
    </div><!-- .content-area -->

<?php get_footer(); ?>

und meine functions.php Seite:

<?php
/**
 * customtheme functions and definitions
 *
 * Set up the theme and provides some helper functions, which are used in the
 * theme as custom template tags. Others are attached to action and filter
 * hooks in WordPress to change core functionality.
 *
 * When using a child theme you can override certain functions (those wrapped
 * in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before
 * the parent theme's file, so the child theme functions would be used.
 *
 * @link https://codex.wordpress.org/Theme_Development
 * @link https://codex.wordpress.org/Child_Themes
 *
 * Functions that are not pluggable (not wrapped in function_exists()) are
 * instead attached to a filter or action hook.
 *
 * For more information on hooks, actions, and filters,
 * {@link https://codex.wordpress.org/Plugin_API}
 *
 * @package WordPress
 * @subpackage custometheme
 * @since 2016
 */

/**
 * Set the content width based on the theme's design and stylesheet.
 *
 * @since 2016
 */


function customtheme_setup() {

    /*
     * Let WordPress manage the document title.
     * By adding theme support, we declare that this theme does not use a
     * hard-coded <title> tag in the document head, and expect WordPress to
     * provide it for us.
     */
        add_theme_support( 'title-tag' );


    /*
     * Enable support for Post Thumbnails on posts and pages.
     *
     * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
     */
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 825, 510, true );
    // For adding Menus
    register_nav_menus( array(
        'primary' => __( 'NavMenu', 'Primary Menu' ),
        'PFooter1'  => __( 'Product Footer1', 'Product Footer1'  ),
            'PFooter2'  => __( 'Product Footer2', 'Product Footer2'  ),
            'CFooter1'  => __( 'Company Footer1', 'Company Footer1'  ),
            'CFooter2'  => __( 'Company Footer2', 'Company Footer2'  ),
             'ContactUs'  => __( 'ContactUs', 'ContactUs'  ),
            ) );

        add_theme_support( 'html5', array(
        'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
    ) );

            /*
     * Enable support for Post Formats.
     *
     * See: https://codex.wordpress.org/Post_Formats
     */
    add_theme_support( 'post-formats', array(
        'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
    ) );


    // Setup the WordPress core custom background feature.
    add_theme_support( 'custom-background', apply_filters( 'custometheme_custom_background_args', array(
        'default-color'      => $default_color,
        'default-attachment' => 'fixed',
    ) ) );

}

add_action( 'init', 'customtheme_setup' );


/**
 * Register our sidebars and widgetized areas.
 *
 */

if ( function_exists('register_sidebar') ){

    register_sidebar( array(
        'name'          => 'Footer Icons Bar',
        'id'            => 'home_right_1',
        'before_widget' => '<span class="footerIcons">',
        'after_widget'  => '</span>',
//      'before_title'  => '<h2 class="rounded">',
//      'after_title'   => '</h2>',
    ) );

            register_sidebar( array(
        'name'          => 'Footer CopyRight',
        'id'            => 'home_right_2',
        'before_widget' => '<span class="footercopyright">',
        'after_widget'  => '</span>',
//      'before_title'  => '<h2 class="rounded">',
//      'after_title'   => '</h2>',
    ) );


}









//function customtheme_widgets_init() {
//
//  register_sidebar( array(
//      'name'          => 'Footer Icons Bar',
//      'id'            => 'home_right_1',
//      'before_widget' => '<span class="footerIcons">',
//      'after_widget'  => '</span>',
////        'before_title'  => '<h2 class="rounded">',
////        'after_title'   => '</h2>',
//  ) );
//
//}
//
//add_action( 'widgets_init', 'customtheme_widgets_init' );

//  register_sidebar( array(
//      'name'          => 'Footer Copyright',
//      'id'            => 'home_right_2',
//      'before_widget' => '<span class="footercopyright">',
//      'after_widget'  => '</span>',
////        'before_title'  => '<h2 class="rounded">',
////        'after_title'   => '</h2>',
//  ) );
//        add_action( 'widgets_init', 'customtheme_widgets_init' );



?>
1
user90111

Problem gelöst . Da ich mein benutzerdefiniertes Thema von Grund auf neu erstellt habe, war in meinem benutzerdefinierten Thema keine content.php-Datei enthalten, die die Titel und Inhalte der Beiträge anzeigt, die ich hinzugefügt habe. und es kann auch gelöst werden, wenn Sie diese Zeile in Ihrer index.php-Seite hinzufügen.

the_content();

oder

the_title();

was auch immer du brauchst. Das kann in der while-Schleife so sein:

while ( have_posts() ) : the_post();

                /*
                 * 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() );
the_content();
the_title();
            // End the loop.
            endwhile;
1
user90119