រចនា​ទំព័រ​​ស្តាទិក


ទំព័រ​ស្តាទិក (static) គឺ​ជា​​បណ្តា​ទំព័រទាំងឡាយ​ណា ដែល​មាន​ប្រភេទ​ជា «page» ដែល​ខុស​ពី​ទំព័រ​មាន​ប្រភេទ​ជា «post» នៅ​ក្នុង​ប្រព័ន្ធ​ WordPress ។ ហើយ​ដើម្បី​រចនា​ទំព័រ​ស្តាទិក​នេះ យើង​ត្រូវ​បើកឯកសារ​មានឈ្មោះថា page.php រួច​សរសេរ​នៅ​ក្នុង​នោះ​នូវ​កូដ​មួយ​ចំនួន​ដូច​ខាង​ក្រោម​នេះ៖

<?php
/**
 * The template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site may use a
 * different template.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Lotus_Blue
 */

get_header();
?>

<?php
  if(!wp_is_mobile()){
    get_template_part( 'template-parts/home', 'ad' );
  }
?>

<?php while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content', 'page' ); // 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; endwhile; // End of the loop. ?>
<?php get_sidebar(); get_footer();

បន្ទាប់មកទៀត យើងត្រូវ​បើក​ឯកសារ​ឈ្មោះ​ content-page.php នៅ​ក្នុង​ថត​ឈ្មោះ template-parts នៅ​សរសេរ​កូដ​មួយ​ចំនួន​ នៅ​ក្នុង​ឯកសារ​នោះ​ ដូច​ខាងក្រោម​នេះ៖


<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  
<?php the_title( '

', '

' ); ?>
<?php lotus_blue_post_thumbnail(); ?>
<?php the_content(); wp_link_pages( array( 'before' => '', ) ); ?>
<?php if ( get_edit_post_link() ) : ?>
<?php edit_post_link( sprintf( wp_kses( /* translators: %s: Name of current post. Only visible to screen readers */ __( 'Edit %s', 'lotus-blue' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ), '', '' ); ?> Share
<?php endif; ?> </article>