---
title: 'การ inherit Theme'
url: 'https://grav.123.in.th/blog-menu/switch-theme'
markdown: 'https://grav.123.in.th/blog-menu/switch-theme.md'
date: '2026-07-14'
description: 'Grav ไม่แนะนำให้เราทำการ customize theme ด้วยการแก้ไขที่ไฟล์ของ theme โดยตรง แต่ควรจะทำการ สร้าง theme ลูกขึ้นมาโดยให้มัน inherit จาก theme แม่ที่เราต้องการ วิธีทำ'
---

# การ inherit Theme

## [การ inherit Theme](https://grav.123.in.th/blog-menu/switch-theme)

    14th Jul 2026  

Grav ไม่แนะนำให้เราทำการ customize theme ด้วยการแก้ไขที่ไฟล์ของ theme โดยตรง แต่ควรจะทำการ สร้าง theme ลูกขึ้นมาโดยให้มัน inherit จาก theme แม่ที่เราต้องการ

### วิธีทำ

1. สร้างโฟวเดอร์ **user/themes/mytheme**
2. copy YAML ของธีมที่ต้องการใช้เป็น theme แม่ไปไว้ที่โฟวเดอร์ที่เราสร้างขึ้น /user/themes/mytheme/mytheme.yaml แล้วเพิ่ม code นี้เข้าไป (แทนที่ user/themes/quark ด้วย theme แม่ของคุณ) 
    ```

    streams:
    schemes:
    theme:
      type: ReadOnlyStream
      prefixes:
        '':
          - user/themes/mytheme
          - user/themes/quark

    ```

    หมายเหตุ - ตรวจสอบ indent ของ yaml ด้วย
3. copy **/user/themes/quark/blueprints.yaml** file ไปที่ **/user/themes/mytheme/blueprints.yaml**
4. copy เฉพาะไฟล์ที่ต้องการแก้ไข เช่น css หรือ twig จาก theme แม่มาใส่ใน folder ของเราแล้วแก้ไขที่โฟวเดอร์ใหม่ตามต้องการ

ไฟล์ของ theme แม่ที่ไม่ได้ถูก copy มาจะใช้จากไฟล์ของ theme แม่

ประโยชน์ของการ inherit theme แทนที่จะแก้ไขที่ไฟล์ของ theme โดยตรงคือเมื่อมีการ update theme แม่ก็จะไม่กระทบกับส่วนที่เราแก้ไขใหม่

 [ Previous Post](https://grav.123.in.th/blog-menu/blog-sub-menu)

#### Popular Tags

---

## Navigation

- Parent: [Blog](https://grav.123.in.th/blog-menu.md)
- Next: [การสร้างเมนูย่อยใน blog](https://grav.123.in.th/blog-menu/blog-sub-menu.md)
