
ដើម្បីរចនាទំរង់គេហទំព័រអោយចែកជា ៣ ផ្នែក យើងចាំបាច់ត្រូវបើកឯកសារឈ្មោះ header.php នៅក្នុងថតដែលជាគំរូគេហទំព័រ Underscores របស់យើង។ បន្ទាប់មកទៀត យើងត្រូវសរសេរកូដ CSS នៅក្នុងឯកសារ header.php នោះដូចខាងក្រោមនេះ៖
<?php /** * The header for our theme * * This is the template that displays all of the section and everything up until* * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @package Lotus_Blue */ ?> <!doctype html> <html <?php language_attributes(); ?>> <head> <link href='https://fonts.googleapis.com/css?family=Oswald|Bokor|Bayon|Koulen|Moul|Nokora|Hanuman|Metal' rel='stylesheet'> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <style> a:link { text-decoration:none; } .region{ width: 950px; margin: 20px auto 0; } body{ font: 14px/1.5 Hanuman; background: #bbbfc4; } .site{ background: #dde2eb; padding: 20px; border-radius: 4px; } .site-branding{ background: #124094; padding: 25px 15px 20px; text-align: center; } .site-title{ margin:0; } .site-title a{ font: 36px/1.5 Moul; color: white; } .site-description{ color: white; font: italic 18px/1.5 Nokora; margin-bottom:0; } /*ការរចនារបារមាតិកា*/ .main-navigation{ background: #3973db; } ul.nav-menu{ padding: 8px 0; font: 14px/1.5 Bayon; } ul.nav-menu li { display: inline-block; float: none; position: relative; margin-left: 10px; } ul.nav-menu a{ color: lavender; } ul.nav-menu a:hover{ color: white; } /*ការរចនាទំរង់គេហទំព័រ*/ .content-area { float: left; margin: 0 -30% 0 0; width: 100%; } .site-main { margin: 0 30% 0 0; } .site-content .widget-area { float: right; overflow: hidden; width: 30%; } .site-footer { clear: both; width: 100%; } /*ការរចនាសំរាប់ទូរស័ព្ទដៃ*/ @media only screen and (max-width : 768px) { .region{ width: 100%; margin: 0; } ul.nav-menu li{ display: block; margin-right: 0px; padding: 3px 0; } ul.nav-menu{ padding: 8px 0; font: 14px/1.5 Hanuman; } .content-area { margin: 0; } .site-main { margin: 0; } .site-content .widget-area { width: 100%; } } </style> <div id="page" class="site region"> <?php esc_html_e( 'Skip to content', 'lotus-blue' ); ?> <header id="masthead" class="site-header"> <div class="site-branding"> <?php the_custom_logo(); if(is_front_page() && is_home()): ?></header> <div id="content" class="site-content"><?php bloginfo( 'name' ); ?>
<?php else : ?> <?php endif; $lotus_blue_description = get_bloginfo( 'description', 'display' ); if( $lotus_blue_description || is_customize_preview() ) : ?><?php echo $lotus_blue_description; /* WPCS: xss ok. */ ?>
<?php endif; ?>
ចាប់ពីបន្ទាត់លេខ 82 ដល់ 98 គឺជាកូដ CSS ចាំបាច់សំរាប់រចនាទំរង់គេហទំព័រ អោយចែកជា ៣ ផ្នែកគឺផ្នែកខាងស្តាំ (sidebar) ផ្នែកប៉ុស្តិ៍ និង ផ្នែកជើងឬផ្នែកខាងក្រោមគេហទំព័រ (footer) ។
ចាប់ពីបន្ទាត់លេខ 114 ដល់បន្ទាត់លេខ 122 គឺកូដ CSS ចាំបាច់សំរាប់រចនារទំរង់គេហទំព័រសំរាប់ទូរស័ព្ទដៃ៕