Hello. Explain somebody how you can add and edit posts if you are talking about the integration of your layout in WP. That is, in the index.php file, all the code of its layout is inserted, but then the main properties of the WordPress engine are lost. How can separate text blocks connect with the records in the engine. So that you can change the text from the admin in your layout.
2 answers
Everything is up to the content part in header.php , the content part (news) itself is left in index.php , and what's next in footer.php . In index.php first need to write <?php get_header(); ?> <?php get_header(); ?> and at the end <?php get_footer(); ?> <?php get_footer(); ?> . Before the </head> in header.php write <?php wp_head(); ?> <?php wp_head(); ?> , and before the </body> in footer.php - <?php wp_footer(); ?> <?php wp_footer(); ?> .
The index.php file should look something like this:
<?php get_header(); ?> <!-- ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠ°ΠΏΠΊΠΈ --> <div class="content"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- post --> <div class="items"> <!-- Π±Π»ΠΎΠΊ Π½ΠΎΠ²ΠΎΡΡΠΈ --> <?php the_post_thumbnail();?> <!-- ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° ΠΌΠΈΠ½ΠΈΠ°ΡΡΡ --> <h1><?php the_title();?></h1></a> <!-- Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΡΡΠ°ΡΡΠΈ --> <?php the_excerpt(); ?> <!-- ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° ΠΊΠΎΡΠΎΡΠΊΠΎΠ³ΠΎ ΠΎΠΏΠΈΡΠ°Π½ΠΈΡ --> </div> <?php endwhile; ?> <!-- post navigation --> <?php else: ?> <!-- no posts found --> <?php endif; ?> </div> <?php get_footer(); ?> <!-- ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΡΡΠ΅ΡΠ° --> For pictures (the_post_thumbnail ())
Also, don't forget about the functions.php file. Create it and add_theme_support('post-thumbnails'); it there: add_theme_support('post-thumbnails');
PS this is minimized version of the news output ..
Everything is done wrong. Changing the kernel index.php file of the VI means (in your case) the complete disabling of the VI. In no case can the kernel files be touched at all (there are very few exceptions. For example, fix a detected problem until a new version of the VP is installed with the fixed problem).
Do not put the VP into your typesetting, but βstretchβ your mile on the VP. This is done relatively simply. Enough basic knowledge of php / css and the study of data links in the text below.
A modern, updated theme is selected that is similar in structure. A child theme is created in which templates and styles are edited.
More help: Creating topics , Feature Reference
- The answer, as I understand it, is not about the main index.php, but about the Index.php file in the template folder. - labris