๐ŸŽฏ Course Objectives

  • Learn how to create custom themes and pages
  • Work with custom post types and taxonomies
  • Gain in-detail knowledge of the WordPress CMS backend
  • Work with widgets and widget areas
  • Work with default CMS functions and extend its core

โœ… Prerequisites

  • Basic knowledge of web development (HTML/CSS/PHP basics) and general CMS concepts

๐ŸŽ“ Course Outcomes

  • Able to configure and administer the WordPress CMS backend confidently
  • Able to decide when to use a Custom Post Type vs. a Custom Field
  • Able to extend the WordPress core to match project requirements (hooks, shortcodes, widgets)
  • Able to design and build a complete, dynamic WordPress theme from scratch

๐Ÿ“š Reference Book

WordPress to Go: How to Build a WordPress Website on Your Own Domain, from Scratch, Even If You Are a Complete Beginner โ€” Sarah McHarry (Paperback)

๐Ÿ—บ๏ธ Syllabus at a Glance

01
Introduction & Setup
  • What is CMS
  • Installation
  • Dashboard
  • Database
02
Theme
  • Install/Activate
  • Customizer
03
Widget & Plugin
  • Widget areas
  • Plugins
04
Theme Dev
  • Template files
  • The Loop
  • Template tags
05
Advanced Dev
  • Hooks
  • CPT/Taxonomy
  • Widget areas (code)

1Introduction, Installation & Configuration

1.1 What is a Content Management System (CMS)?

A Content Management System is software that lets people create, edit, organize, and publish digital content (text, images, video) without needing to write code for every page. It separates content (stored in a database) from presentation (theme/template files), so non-technical users can manage a website through a visual dashboard while the underlying HTML/CSS/PHP is generated dynamically.

Think of a CMS in two layers: the back-end (admin dashboard where content is authored and stored in a database) and the front-end (public-facing pages, assembled at request-time from that stored content plus the active theme's templates). This separation is what allows the same blog post to look completely different after simply switching a theme.

เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

CMS เชเชŸเชฒเซ‡ เชถเซเช‚? CMS (เช•เชจเซเชŸเซ‡เชจเซเชŸ เชฎเซ‡เชจเซ‡เชœเชฎเซ‡เชจเซเชŸ เชธเชฟเชธเซเชŸเชฎ) เช เชเชตเซเช‚ เชธเซ‹เชซเซเชŸเชตเซ‡เชฐ เช›เซ‡ เชœเซ‡เชจเซ€ เชฎเชฆเชฆเชฅเซ€ เช•เซ‹เชˆเชชเชฃ เชตเซเชฏเช•เซเชคเชฟ เช•เซ‹เชกเชฟเช‚เช— เชœเชพเชฃเซเชฏเชพ เชตเช—เชฐ เชตเซ‡เชฌเชธเชพเชˆเชŸ เชชเชฐ เช•เชจเซเชŸเซ‡เชจเซเชŸ (เชฒเช–เชพเชฃ, เชซเซ‹เชŸเชพ, เชตเชฟเชกเชฟเชฏเซ‹) เชฌเชจเชพเชตเซ€, เชฌเชฆเชฒเซ€ เช…เชจเซ‡ เชชเซเชฐเช•เชพเชถเชฟเชค เช•เชฐเซ€ เชถเช•เซ‡ เช›เซ‡.

CMS เชจเชพ เชฌเซ‡ เชญเชพเช— เชนเซ‹เชฏ เช›เซ‡: เชฌเซ‡เช•-เชเชจเซเชก (เชเชกเชฎเชฟเชจ เชกเซ‡เชถเชฌเซ‹เชฐเซเชก, เชœเซเชฏเชพเช‚ เช•เชจเซเชŸเซ‡เชจเซเชŸ เชกเซ‡เชŸเชพเชฌเซ‡เชเชฎเชพเช‚ เชธเช‚เช—เซเชฐเชน เชฅเชพเชฏ เช›เซ‡) เช…เชจเซ‡ เชซเซเชฐเชจเซเชŸ-เชเชจเซเชก (เชตเซ‡เชฌเชธเชพเชˆเชŸเชจเซ€ เชœเชพเชนเซ‡เชฐ เชฌเชพเชœเซ, เชœเซ‡ เชฅเซ€เชฎเชจเชพ เชŸเซ‡เชฎเซเชชเชฒเซ‡เชŸ เชชเซเชฐเชฎเชพเชฃเซ‡ เชคเซˆเชฏเชพเชฐ เชฅเชพเชฏ เช›เซ‡). เชเชŸเชฒเซ‡ เชœ เชฅเซ€เชฎ เชฌเชฆเชฒเชตเชพเชฅเซ€ เช เชœ เชชเซ‹เชธเซเชŸ เชธเชพเชต เช…เชฒเช— เชฆเซ‡เช–เชพเชฏ เช›เซ‡.

Introduction to WordPress

WordPress is a free, open-source CMS written in PHP and backed by a MySQL/MariaDB database. Originally launched in 2003 as a blogging tool, it has grown into the world's most popular CMS, powering a large share of all websites on the internet โ€” from personal blogs to large e-commerce stores (via WooCommerce) and enterprise sites.

WordPress ships in two flavours students should be able to distinguish: WordPress.org (self-hosted โ€” you download the software, install it on your own server, and have full control/access to files & database โ€” this is what this syllabus covers) versus WordPress.com (a hosted service where Automattic manages the server for you, with more restrictions on themes/plugins on free plans).

Features of WordPress

  • Open source & free โ€” free to download, use, and modify (GPL license)
  • Themes โ€” thousands of free/paid designs to change the site's look instantly
  • Plugins โ€” extend functionality (SEO, forms, e-commerce, caching) without coding
  • User-friendly dashboard โ€” WYSIWYG block editor (Gutenberg) for content creation
  • SEO friendly โ€” clean permalink structure, meta tags, sitemap support
  • Responsive & mobile-ready themes out of the box
  • Multi-user & role management โ€” Admin, Editor, Author, Contributor, Subscriber
  • Media management โ€” built-in library for images, audio, video, documents
  • Custom Post Types & Taxonomies โ€” model any kind of content (products, portfolios, events)
  • Large community & documentation โ€” extensive support ecosystem

Advantages of WordPress

  • Free and open source โ€” low cost of ownership
  • Easy for beginners; no coding required for basic sites
  • Massive plugin/theme ecosystem โ€” rapid development
  • SEO-friendly architecture
  • Scalable โ€” from a single blog to enterprise (news portals, e-commerce)
  • Regular security updates and an active community

Disadvantages of WordPress

  • Frequent plugin/theme updates can cause compatibility conflicts
  • Security is dependent on keeping core/plugins updated (common attack target due to popularity)
  • Heavy use of plugins can slow site performance
  • Customization beyond a point requires PHP/CSS/JS knowledge
  • Database-driven โ€” needs proper backup/maintenance discipline

1.2 Installation of WordPress

WordPress can be installed locally (for learning/development) using a stack like XAMPP/WAMP (Apache + MySQL + PHP), or on live hosting via cPanel/Softaculous or manual upload.

Local Installation Steps (XAMPP)

  1. Install XAMPP and start the Apache and MySQL modules.
  2. Download the latest WordPress ZIP from wordpress.org and extract it into C:\xampp\htdocs\mysite.
  3. Open phpMyAdmin (http://localhost/phpmyadmin) and create a new database, e.g. wp_mysite.
  4. Visit http://localhost/mysite in a browser โ€” the WordPress installer (the "famous 5-minute install") launches.
  5. Enter database name, username (root), password, and host (localhost).
  6. Set the site title, admin username, password, and email โ€” click Install WordPress.
  7. Log in to /wp-admin with the created credentials.
๐Ÿ’ก Live hosting shortcut: most hosting providers offer a one-click WordPress installer (Softaculous/Installatron) inside cPanel, which automates database creation and file setup.
โš ๏ธ Common installation error: "Error establishing a database connection" almost always means wp-config.php has the wrong DB name/username/password/host โ€” double-check these four values first.
wp-config.php code editor view showing database constants
Fig 1.0 โ€” wp-config.php: the four database constants that installation writes automatically
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

เชˆเชจเซเชธเซเชŸเซ‹เชฒเซ‡เชถเชจ เชเชฐเชฐ เช•เซ‡เชฎ เช†เชตเซ‡ เช›เซ‡? เชฎเซ‹เชŸเชพเชญเชพเช—เชจเซ€ "Database connection" เชญเซ‚เชฒ เชเชŸเชฒเชพ เชฎเชพเชŸเซ‡ เช†เชตเซ‡ เช›เซ‡ เช•เชพเชฐเชฃ เช•เซ‡ wp-config.php เชซเชพเชˆเชฒเชฎเชพเช‚ เชกเซ‡เชŸเชพเชฌเซ‡เชเชจเซเช‚ เชจเชพเชฎ, เชฏเซเชเชฐเชจเซ‡เชฎ, เชชเชพเชธเชตเชฐเซเชก เช…เชฅเชตเชพ เชนเซ‹เชธเซเชŸ เช–เซ‹เชŸเซเช‚ เชฒเช–เชพเชฏเซ‡เชฒเซเช‚ เชนเซ‹เชฏ เช›เซ‡. phpMyAdmin เชฎเชพเช‚ เชœเชˆเชจเซ‡ เชกเซ‡เชŸเชพเชฌเซ‡เชเชจเซเช‚ เชธเชพเชšเซเช‚ เชจเชพเชฎ เชšเซ‡เช• เช•เชฐเซ‹ เช…เชจเซ‡ wp-config.php เชฎเชพเช‚ เช เชœ เชจเชพเชฎ เชฎเซ‡เชš เช•เชฐเซ‹.

1.3 WordPress Directory & File Structure

WordPress directory structure diagram
Fig 1.1 โ€” Root-level folders/files of a WordPress installation
Folder / FilePurpose
wp-admin/Core files that power the admin dashboard (never edit)
wp-includes/Core WordPress library files, classes, functions (never edit)
wp-content/themes/All installed themes live here โ€” this is where custom theme development happens
wp-content/plugins/All installed plugins
wp-content/uploads/Media library files, organized by year/month
wp-config.phpDatabase connection details, security keys, debug settings
index.phpFront controller that loads the WordPress bootstrap
.htaccessApache rewrite rules for pretty permalinks
๐Ÿ“Œ Golden rule: the only folder you should ever edit inside is wp-content. Everything in wp-admin and wp-includes gets overwritten on every core update.

1.4 Dashboard Overview

WordPress admin dashboard layout
Fig 1.2 โ€” Anatomy of the wp-admin dashboard: Admin bar, left navigation menu, main work area

The dashboard (/wp-admin) is the control panel of the site. The left menu gives access to Posts, Media, Pages, Comments, Appearance, Plugins, Users, Tools, and Settings. The main panel shows widgets like "At a Glance" (content counts), "Activity," and "Quick Draft."

Adding, Editing & Deleting Content

  • Post: Posts โ†’ Add New โ†’ write title/content โ†’ set Category & Tags โ†’ Publish. Edit via Posts โ†’ All Posts โ†’ click title. Delete moves it to Trash first (permanently deletable from Trash).
  • Page: Similar to Posts but for static content (About, Contact) โ€” Pages don't use categories/tags and support a Page Attributes panel (Template, Parent, Order).
  • Category: Posts โ†’ Categories โ†’ add Name, Slug, Parent, Description. Categories are hierarchical (can have parent/child).
  • Tag: Posts โ†’ Tags โ€” flat (non-hierarchical) keywords used for cross-referencing content.
  • Media: Media โ†’ Add New, or drag-and-drop directly inside the block editor. Supports images, PDFs, docs, audio, video; each file gets a Title, Alt Text, Caption, and Description, and can be attached to a specific post/page.
Add New Post screen with Gutenberg editor and Publish sidebar
Fig 1.2a โ€” Posts โ†’ Add New: block editor (left) + Post settings sidebar (right) with Status, Categories, Tags, Featured Image
Media Library grid view with attachment details panel
Fig 1.2b โ€” Media Library grid view; clicking a file opens its Attachment Details (Title, Alt Text, URL)
Categories admin screen with add-new form and existing categories table
Fig 1.2c โ€” Posts โ†’ Categories: add-new form (left) and the existing hierarchy with post counts (right)
๐Ÿ“Œ Alt Text vs. Caption vs. Description (Media): Alt Text is read by screen readers and search engines (accessibility + SEO) and should describe the image; Caption displays visibly under the image; Description is an internal note, rarely shown on the front end.
Post vs Page comparison diagram
Fig 1.3 โ€” Post vs. Page: when to use which
Category vs Tag comparison diagram
Fig 1.4 โ€” Category (hierarchical) vs. Tag (flat)

1.5 Gutenberg โ€” The Block Editor

Gutenberg is WordPress's default content editor (since v5.0), where every piece of content โ€” a paragraph, image, or button โ€” is a self-contained block that can be added, rearranged (drag handles), and styled individually.

Gutenberg block palette illustration
Fig 1.5 โ€” Common Gutenberg blocks available from the "+" inserter
BlockUse
ParagraphBasic text content
Heading / SubheadingH1โ€“H6 section titles
QuoteBlockquote styling for citations
Image / Cover ImageSingle image or a full-width image with overlay text
GalleryMultiple images in a grid
Video / AudioEmbed self-hosted or linked media
ColumnsMulti-column layouts
CodePreformatted code snippets
ListBulleted/numbered lists
ButtonCall-to-action links styled as buttons
EmbedsYouTube, Twitter/X, Instagram and other oEmbed content

1.6 User Roles & Capabilities

WordPress user roles capability pyramid
Fig 1.6 โ€” Capability pyramid: each role down the list has fewer capabilities
RoleCapabilities
AdministratorFull control โ€” themes, plugins, users, settings, all content
EditorPublish/manage all posts & pages (own and others'), moderate comments
AuthorPublish and manage only their own posts
ContributorWrite and edit their own posts but cannot publish (awaits review)
SubscriberManage their own profile only; typically read content, leave comments
Users list admin screen showing role badges
Fig 1.6a โ€” Users โ†’ All Users: each account shows its assigned role and post count

1.7 Settings Overview

  • General โ€” Site Title, Tagline, WordPress/Site Address, Admin Email, Timezone, Date/Time format
  • Writing โ€” default post category/format, "Post via email," update services
  • Reading โ€” homepage display (latest posts / static page), posts per page, search engine visibility
  • Discussion โ€” comment settings, moderation, avatar display
  • Media โ€” image thumbnail/medium/large dimensions, uploads folder organization
  • Permalinks โ€” URL structure (Plain, Day/Name, Month/Name, Post name, Custom) โ€” "Post name" is the SEO-recommended option
Permalink structure comparison
Fig 1.7 โ€” Permalink structures compared
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Permalink เชเชŸเชฒเซ‡ เชถเซเช‚? Permalink เชเชŸเชฒเซ‡ เชคเชฎเชพเชฐเซ€ เชชเซ‹เชธเซเชŸ เช•เซ‡ เชชเซ‡เชœเชจเซ€ เช•เชพเชฏเชฎเซ€ (permanent) URL. เชœเซ‹ "Plain" เชชเชธเช‚เชฆ เช•เชฐเซ‹ เชคเซ‹ URL เชฎเชพเช‚ ?p=123 เชœเซ‡เชตเซเช‚ เช…เช˜เชฐเซเช‚ เชฆเซ‡เช–เชพเชฏ, เชœเซ‡ เชจเชพ เชคเซ‹ เชฏเซเชเชฐเชจเซ‡ เชธเชฎเชœเชพเชฏ เชจเชพ Google เชจเซ‡ เช—เชฎเซ‡.

"Post name" เชชเชธเช‚เชฆ เช•เชฐเชตเชพเชฅเซ€ URL เชธเชพเชซ เช…เชจเซ‡ เชธเชฎเชœเซ€ เชถเช•เชพเชฏ เชคเซ‡เชตเซเช‚ เชฌเชจเซ‡ เช›เซ‡ (เชฆเชพ.เชค. /my-first-post/), เชœเซ‡ SEO เชฎเชพเชŸเซ‡ เชถเซเชฐเซ‡เชทเซเช  เช—เชฃเชพเชฏ เช›เซ‡ โ€” เชคเซ‡เชฅเซ€ เชœ เชชเชฐเซ€เช•เซเชทเชพเชฎเชพเช‚ เช…เชจเซ‡ เชชเซเชฐเซ‡เช•เซเชŸเชฟเช•เชฒเชฎเชพเช‚ เช† เชธเซ‡เชŸเชฟเช‚เช— เชธเซŒเชฅเซ€ เชตเชงเซ เชญเชฒเชพเชฎเชฃ เช•เชฐเชตเชพเชฎเชพเช‚ เช†เชตเซ‡ เช›เซ‡.

1.8 Updating WordPress

  • One-click Update โ€” Dashboard โ†’ Updates โ†’ click "Update Now" (recommended, safest for minor/major releases)
  • Manual Update โ€” download the new version from wordpress.org, back up the database and files, replace wp-admin and wp-includes folders, then re-run /wp-admin/upgrade.php
โš ๏ธ Always take a full backup (files + database) before any manual update.

1.9 Database Structure

WordPress uses a relational database (MySQL). Default core tables (prefix wp_):

WordPress database ER diagram
Fig 1.8 โ€” Simplified relationships between core WordPress tables
TableStores
wp_postsPosts, pages, custom post types, revisions, attachments
wp_postmetaCustom fields / meta data linked to a post
wp_usersUser accounts
wp_usermetaExtra user meta data (role, nickname, capabilities)
wp_termsCategories, tags, and custom taxonomy terms
wp_term_taxonomyDescribes the taxonomy each term belongs to
wp_term_relationshipsLinks posts to terms (categories/tags)
wp_commentsComments on posts
wp_commentmetaMeta data about comments
wp_optionsSite-wide settings (site title, active theme, plugin options)
wp_linksLegacy "Blogroll" links feature

Notice that a post's category/tag isn't stored directly on the post row โ€” it goes through wp_term_relationships, which links a post ID to a term_taxonomy_id. This indirection (many-to-many relationship) is what lets one post belong to multiple categories, and one category hold many posts, efficiently.

เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

เชกเซ‡เชŸเชพเชฌเซ‡เช เช•เซ‡เชฎ เชฎเชนเชคเซเชตเชจเซเช‚ เช›เซ‡? WordPress เชจเซ€ เชฆเชฐเซ‡เช• เชชเซ‹เชธเซเชŸ, เชชเซ‡เชœ, เชฏเซเชเชฐ เช…เชจเซ‡ เชธเซ‡เชŸเชฟเช‚เช— เชกเซ‡เชŸเชพเชฌเซ‡เช (MySQL) เชฎเชพเช‚ เชŸเซ‡เชฌเชฒ เชธเซเชตเชฐเซ‚เชชเซ‡ เชธเช‚เช—เซเชฐเชนเชพเชฏ เช›เซ‡. wp_posts เชŸเซ‡เชฌเชฒเชฎเชพเช‚ เชชเซ‹เชธเซเชŸ/เชชเซ‡เชœเชจเซเช‚ เชฒเช–เชพเชฃ เชนเซ‹เชฏ เช›เซ‡, wp_users เชฎเชพเช‚ เชฏเซเชเชฐเชจเซ€ เชฎเชพเชนเชฟเชคเซ€, เช…เชจเซ‡ wp_options เชฎเชพเช‚ เชธเชพเชˆเชŸเชจเซ€ เชธเซ‡เชŸเชฟเช‚เช—เซเชธ (เชœเซ‡เชฎ เช•เซ‡ เช•เชˆ เชฅเซ€เชฎ เชเช•เซเชŸเชฟเชต เช›เซ‡) เชธเช‚เช—เซเชฐเชนเชพเชฏ เช›เซ‡.

เช•เซ‡เชŸเซ‡เช—เชฐเซ€ เช…เชจเซ‡ เชชเซ‹เชธเซเชŸ เชตเชšเซเชšเซ‡เชจเซ‹ เชธเช‚เชฌเช‚เชง เชธเซ€เชงเซ‹ เชจเชฅเซ€ เชนเซ‹เชคเซ‹ โ€” เชคเซ‡ wp_term_relationships เชจเชพเชฎเชจเชพ เช…เชฒเช— เชŸเซ‡เชฌเชฒ เชฎเชพเชฐเชซเชคเซ‡ เชœเซ‹เชกเชพเชฏ เช›เซ‡, เชœเซ‡เชฅเซ€ เชเช• เชชเซ‹เชธเซเชŸเชจเซ‡ เชเช•เชฅเซ€ เชตเชงเซ เช•เซ‡เชŸเซ‡เช—เชฐเซ€เชฎเชพเช‚ เชฎเซ‚เช•เซ€ เชถเช•เชพเชฏ.

๐Ÿงช Unit 1 โ€” Lab Practicals

  1. Install XAMPP/WAMP and set up a local WordPress installation using phpMyAdmin.
  2. Explore the WordPress directory structure and identify wp-config.php settings.
  3. Create 5 posts using different Gutenberg blocks (Heading, Image, Gallery, Quote, List).
  4. Create categories (with a parent-child hierarchy) and tags; assign them to posts.
  5. Upload media files (image, PDF) to the Media Library and attach one to a page.
  6. Create 3 users with different roles (Editor, Author, Contributor) and test their permissions by logging in as each.
  7. Configure General, Reading, and Permalink settings; verify the resulting URL structure.
  8. Use phpMyAdmin to inspect wp_posts and wp_options tables after creating content.

2Theme

2.1 What is a Theme?

A WordPress theme is a collection of template files, stylesheets, and (optionally) JavaScript/images that together define the visual presentation and layout of a site. Themes control how content stored in the database is displayed, without touching the content itself โ€” the same posts can look completely different under a new theme.

เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

เชฅเซ€เชฎ เชถเซเช‚ เช›เซ‡? เชฅเซ€เชฎ เช เชซเชพเชˆเชฒเซ‹เชจเซ‹ เชธเชฎเซ‚เชน เช›เซ‡ เชœเซ‡ เชจเช•เซเช•เซ€ เช•เชฐเซ‡ เช›เซ‡ เช•เซ‡ เชตเซ‡เชฌเชธเชพเชˆเชŸ เช•เซ‡เชตเซ€ เชฆเซ‡เช–เชพเชถเซ‡ โ€” เชฐเช‚เช—เซ‹, เชซเซ‹เชจเซเชŸ, เชฒเซ‡เช†เช‰เชŸ. เช•เชจเซเชŸเซ‡เชจเซเชŸ (เชชเซ‹เชธเซเชŸ/เชชเซ‡เชœ) เชกเซ‡เชŸเชพเชฌเซ‡เชเชฎเชพเช‚ เช…เชฒเช— เชธเช‚เช—เซเชฐเชนเชพเชฏ เช›เซ‡, เชเชŸเชฒเซ‡ เชฅเซ€เชฎ เชฌเชฆเชฒเชตเชพเชฅเซ€ เช•เชจเซเชŸเซ‡เชจเซเชŸ เชกเชฟเชฒเซ€เชŸ เชจเชฅเซ€ เชฅเชคเซเช‚, เชซเช•เซเชค เชคเซ‡เชจเซ‹ เชฆเซ‡เช–เชพเชต เชฌเชฆเชฒเชพเชฏ เช›เซ‡.

2.2 How to Install & Activate a Theme

  1. Go to Appearance โ†’ Themes โ†’ Add New.
  2. Search the WordPress.org theme repository, or click Upload Theme to install a downloaded .zip file.
  3. Click Install, then Activate to make it the live theme.
  4. Alternatively, upload the theme folder directly to wp-content/themes/ via FTP, then activate it from Appearance โ†’ Themes.

2.3 Theme Customize Options (Appearance โ†’ Customize)

WordPress Customizer panel mockup
Fig 2.1 โ€” The Customizer: sidebar panels update a live preview on the right
OptionWhat it Controls
Site IdentitySite title, tagline, logo, and site icon (favicon)
MenusCreate/assign navigation menus to theme locations (header, footer)
WidgetsAdd/arrange widgets into the theme's registered widget areas
Homepage SettingsChoose whether the homepage shows the latest posts or a static page
Additional CSSAdd custom CSS live, with instant preview, without editing theme files
๐Ÿ’ก The Customizer applies changes in a live-preview pane โ€” nothing goes live until you click Publish.

Building a Navigation Menu โ€” Step by Step

Menu builder drag and drop screen
Fig 2.2 โ€” Appearance โ†’ Menus: drag pages from the left into the menu structure, nest items to create dropdowns
  1. Go to Appearance โ†’ Menus โ†’ create a new menu, give it a name (e.g. "Primary Menu").
  2. Tick the Pages/Posts/Categories to add from the left panel, click Add to Menu.
  3. Drag items to reorder; drag an item slightly right and drop it under another to make it a sub-menu (dropdown).
  4. Under Menu Settings, tick the theme location (e.g. "Primary Menu") to assign it, then Save Menu.

๐Ÿงช Unit 2 โ€” Lab Practicals

  1. Install and activate two different free themes from the repository; compare their layouts.
  2. Set Site Identity โ€” upload a logo and site icon, set title & tagline.
  3. Create a custom navigation menu and assign it to the header location.
  4. Configure the homepage to display a static "Home" page instead of the blog feed.
  5. Add custom CSS via the Customizer to change the site's primary color/fonts.

3Widget & Plugin

3.1 What is a Widget & Widget Area?

A widget is a small, self-contained block of content or functionality (e.g., a search box, recent posts list, calendar) that can be dragged into a widget area โ€” a theme-defined region such as a sidebar or footer โ€” without writing code.

Available Widgets

Archive ยท Calendar ยท Categories ยท Navigation Menu ยท Meta ยท Pages ยท Recent Comments ยท Recent Posts ยท RSS ยท Search ยท Tag Cloud ยท Text ยท Image ยท Gallery ยท Video ยท Audio ยท Custom HTML

Widget Management

Managed via Appearance โ†’ Widgets (block-based widgets screen) or through the Customizer's Widgets panel. Widgets can be dragged between areas, reordered, and configured with their own settings (title, number of items, etc.).

Widgets management screen showing sidebar, footer widget area, and inactive widgets
Fig 3.1a โ€” Appearance โ†’ Widgets: multiple widget areas (Sidebar, Footer) plus the Inactive Widgets bin
Rendered footer widget area example
Fig 3.1 โ€” Example of a footer widget area with three widgets rendered on the front end

Inactive Sidebar / Inactive Widgets

When a theme is switched, widgets from areas that no longer exist in the new theme are automatically moved to an Inactive Widgets bin rather than being deleted โ€” so they can be restored later if you switch back or the new theme adds a matching area.

3.2 Plugins

What is a Plugin?

A plugin is a packaged piece of PHP code that hooks into WordPress core to add or extend functionality โ€” e.g., SEO tools, contact forms, e-commerce, caching โ€” without modifying core files, so features survive core/theme updates.

เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Widget เช…เชจเซ‡ Plugin เชตเชšเซเชšเซ‡ เชซเชฐเช•: Widget เช เชจเชพเชจเซเช‚, เชคเซˆเชฏเชพเชฐ content block เช›เซ‡ (เชœเซ‡เชฎ เช•เซ‡ Search box) เชœเซ‡ เชซเช•เซเชค drag-and-drop เช•เชฐเซ€เชจเซ‡ sidebar/footer เชฎเชพเช‚ เชฎเซ‚เช•เซ€ เชถเช•เชพเชฏ โ€” เชคเซ‡เชจเชพ เชฎเชพเชŸเซ‡ เช•เซ‹เชกเชฟเช‚เช—เชจเซ€ เชœเชฐเซ‚เชฐ เชจเชฅเซ€.

Plugin เช เชฎเซ‹เชŸเซเช‚, เชธเช‚เชชเซ‚เชฐเซเชฃ เชซเซ€เชšเชฐ เช‰เชฎเซ‡เชฐเชคเซเช‚ เชธเซ‹เชซเซเชŸเชตเซ‡เชฐ เช›เซ‡ (เชœเซ‡เชฎ เช•เซ‡ เช†เช–เซเช‚ Contact Form เชธเชฟเชธเซเชŸเชฎ, เช…เชฅเชตเชพ SEO เชŸเซ‚เชฒ) เชœเซ‡ WordPress เชจเซ€ เช•เซเชทเชฎเชคเชพ เชตเชงเชพเชฐเซ‡ เช›เซ‡. เช˜เชฃเซ€ เชตเช–เชค เชเช• plugin เชชเซ‹เชคเชพเชจเซเช‚ widget เชชเชฃ เชฌเชจเชพเชตเซ‡ เช›เซ‡.

How to Install & Activate a Plugin

Plugin repository grid with install buttons
Fig 3.2a โ€” Plugins โ†’ Add New: browse or search the repository, click Install Now then Activate
Plugin install and activate flow diagram
Fig 3.2b โ€” Plugin install โ†’ activate workflow
  1. Plugins โ†’ Add New โ†’ search the repository โ†’ Install Now โ†’ Activate.
  2. Or Upload Plugin to install a downloaded .zip file.
  3. Or upload the plugin folder to wp-content/plugins/ via FTP, then activate from the Plugins screen.

Useful Plugins for a Website

PluginPurpose
SEO โ€” YoastOn-page SEO analysis, meta tags, XML sitemap
Contact Form 7Build and manage contact forms
WooCommerceTurns WordPress into a full e-commerce store
WP Super CachePage caching to improve performance
Regenerate ThumbnailsRebuilds image thumbnail sizes after a theme change
Advanced Custom Fields (ACF)Adds custom meta-box fields to posts/pages/CPTs
All-in-One WP MigrationExports/imports an entire site (files + DB) for migration
Custom Post Type WidgetsDisplay custom post type content in widget areas

๐Ÿงช Unit 3 โ€” Lab Practicals

  1. Add Search, Recent Posts, and Categories widgets to the sidebar; reorder them.
  2. Switch the active theme and observe widgets moving to the Inactive Widgets area; restore them.
  3. Install and activate Yoast SEO; run an SEO analysis on a sample post.
  4. Install Contact Form 7; build and embed a contact form on a page using its shortcode.
  5. Install WooCommerce and add one sample product to the store.

4Theme Development

4.1 Anatomy of a Theme

Theme anatomy diagram: header, loop, sidebar, footer
Fig 4.1 โ€” How header.php, the Loop, sidebar.php and footer.php compose a page

Every page render in WordPress typically stitches together three re-usable pieces โ€” header.php, footer.php, and optionally sidebar.php โ€” around the page-specific template that runs the Loop.

Minimum Required & Common Template Files

FileRole
style.cssRequired. Contains theme metadata comment header (Name, Author, Version) + CSS rules
index.phpRequired fallback template โ€” the main/blog template
header.phpOpening HTML, <head>, site branding, nav menu
footer.phpClosing HTML, footer widgets/credits, wp_footer() hook
sidebar.phpSidebar widget area markup
page.phpTemplate for static Pages
home.phpTemplate for the blog posts index (if different from front page)
archive.phpTemplate for date/author/CPT archive listings
single.phpTemplate for a single blog post
comments.phpComment form and comment list markup
search.phpSearch results template
attachment.phpTemplate for viewing a single media attachment
404.php"Page not found" template
category.php / tag.phpCategory-specific / tag-specific archive templates
author.phpAuthor archive template
date.phpDate-based archive template

The Template Hierarchy

WordPress decides which template file to load for a given URL by walking a fixed priority order โ€” the Template Hierarchy โ€” from most specific to most general, always falling back to index.php if nothing more specific exists.

Template hierarchy flowchart
Fig 4.2 โ€” Simplified Template Hierarchy showing fallback order per content type
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Template Hierarchy เชเชŸเชฒเซ‡ เชถเซเช‚? เชœเซเชฏเชพเชฐเซ‡ เช•เซ‹เชˆ เชฏเซเชเชฐ เชตเซ‡เชฌเชธเชพเชˆเชŸ เชชเชฐ เช•เซ‹เชˆ page เช–เซ‹เชฒเซ‡, เชคเซเชฏเชพเชฐเซ‡ WordPress เชจเช•เซเช•เซ€ เช•เชฐเซ‡ เช›เซ‡ เช•เซ‡ เช•เชˆ เชŸเซ‡เชฎเซเชชเชฒเซ‡เชŸ เชซเชพเชˆเชฒ เชตเชพเชชเชฐเชตเซ€. เชคเซ‡ เชชเชนเซ‡เชฒเชพ เชธเซŒเชฅเซ€ เชšเซ‹เช•เซเช•เชธ (specific) เชซเชพเชˆเชฒ เชถเซ‹เชงเซ‡ เช›เซ‡ โ€” เชฆเชพ.เชค. เชเช• movie เชชเซ‹เชธเซเชŸ เชฎเชพเชŸเซ‡ single-movie.php โ€” เช…เชจเซ‡ เชœเซ‹ เช เชจเชพ เชฎเชณเซ‡ เชคเซ‹ เชธเชพเชฎเชพเชจเซเชฏ เชซเชพเชˆเชฒ เชคเชฐเชซ เชœเชพเชฏ เช›เซ‡, เช›เซ‡เชฒเซเชฒเซ‡ index.php เชธเซเชงเซ€, เชœเซ‡ เชฆเชฐเซ‡เช• เชฅเซ€เชฎเชฎเชพเช‚ เชนเซ‹เชตเซ€ เชœ เชœเซ‹เชˆเช.

4.2 The Loop

The WordPress Loop flowchart
Fig 4.3 โ€” have_posts() / the_post() cycle that outputs each matching post

The Loop is the core PHP construct that WordPress uses to display posts. It iterates over the post(s) matched by the current query and, for each one, sets up post data so template tags like the_title() work correctly.

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <h2><?php the_title(); ?></h2>
    <div><?php the_content(); ?></div>

<?php endwhile; else : ?>
    <p>No posts found.</p>
<?php endif; ?>
๐Ÿ“Œ Every custom loop with WP_Query must end with wp_reset_postdata(); to restore the main query's global $post object.
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

The Loop เชถเซเช‚ เช›เซ‡? The Loop เช PHP เชจเซ‹ เชเชตเซ‹ เช•เซ‹เชก เช›เซ‡ เชœเซ‡ เชเช• เชชเช›เซ€ เชเช• เชฌเชงเซ€ เชชเซ‹เชธเซเชŸ เชคเชชเชพเชธเซ‡ เช›เซ‡ เช…เชจเซ‡ เชฆเชฐเซ‡เช•เชจเซ‡ เชธเซเช•เซเชฐเซ€เชจ เชชเชฐ เชฌเชคเชพเชตเซ‡ เช›เซ‡. have_posts() เชšเซ‡เช• เช•เชฐเซ‡ เช›เซ‡ เช•เซ‡ เชนเชœเซ เชชเซ‹เชธเซเชŸ เชฌเชพเช•เซ€ เช›เซ‡ เช•เซ‡ เชจเชนเซ€เช‚, เช…เชจเซ‡ the_post() เช†เช—เชฒเซ€ เชชเซ‹เชธเซเชŸเชจเซ‹ เชกเซ‡เชŸเชพ เชคเซˆเชฏเชพเชฐ เช•เชฐเซ‡ เช›เซ‡ โ€” เชคเซเชฏเชพเชฐ เชชเช›เซ€ เชœ the_title() เช…เชจเซ‡ the_content() เชœเซ‡เชตเชพ เชŸเซ‡เช— เชธเชพเชšเซเช‚ เช†เช‰เชŸเชชเซเชŸ เช†เชชเซ‡ เช›เซ‡.

เชธเชนเซ‡เชฒเซ€ เชฐเซ€เชคเซ‡ เชฏเชพเชฆ เชฐเชพเช–เซ‹: "เชœเซเชฏเชพเช‚ เชธเซเชงเซ€ เชชเซ‹เชธเซเชŸ เช›เซ‡ เชคเซเชฏเชพเช‚ เชธเซเชงเซ€ โ€” เช†เช—เชฒเซ€ เชชเซ‹เชธเซเชŸ เชฒเซ‹, เช…เชจเซ‡ เชเชจเซ‡ เช›เชพเชชเซ‹."

Frontend rendered blog page showing the Loop output
Fig 4.3a โ€” What the Loop's output looks like on the live site: each post block below the header comes from one Loop iteration

4.3 Template Tags

Single post frontend view with comments and post navigation
Fig 4.3b โ€” single.php rendered on the front end: title, content, comments, and prev/next post links โ€” all produced by Template Tags
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Template Tag เชเชŸเชฒเซ‡ เชถเซเช‚? Template Tag เช PHP เชจเซเช‚ เชซเช‚เช•เซเชถเชจ เช›เซ‡ เชœเซ‡ เชฅเซ€เชฎ เชซเชพเชˆเชฒเซ‹เชฎเชพเช‚ เชตเชพเชชเชฐเซ€เชจเซ‡ เชกเซ‡เชŸเชพเชฌเซ‡เชเชฎเชพเช‚เชฅเซ€ เชกเซ‡เชŸเชพ (เชŸเชพเชˆเชŸเชฒ, เช•เชจเซเชŸเซ‡เชจเซเชŸ, เชคเชพเชฐเซ€เช–, เชฒเซ‡เช–เช•เชจเซเช‚ เชจเชพเชฎ เชตเช—เซ‡เชฐเซ‡) เชฎเซ‡เชณเชตเซ€เชจเซ‡ เชธเซเช•เซเชฐเซ€เชจ เชชเชฐ เชฌเชคเชพเชตเซ‡ เช›เซ‡. เชฆเชพ.เชค. the_title() เชชเซ‹เชธเซเชŸเชจเซเช‚ เชŸเชพเชˆเชŸเชฒ เช›เชพเชชเซ‡ เช›เซ‡, the_content() เช†เช–เซเช‚ เชฒเช–เชพเชฃ เช›เชพเชชเซ‡ เช›เซ‡.

เชฏเชพเชฆ เชฐเชพเช–เชตเชพเชจเซ€ เชธเชนเซ‡เชฒเซ€ เชฐเซ€เชค: เชจเชพเชฎเชฎเชพเช‚ "the_" เชนเซ‹เชฏ เชคเซ‡ เชธเซ€เชงเซเช‚ เช›เชพเชชเซ‡ (echo), เช…เชจเซ‡ "get_the_" เชนเซ‹เชฏ เชคเซ‡ เชตเซ‡เชฒเซเชฏเซ เชชเชพเช›เซ€ เช†เชชเซ‡ (return) โ€” เชœเซ‡เชจเซ‡ เชคเชฎเซ‡ เชšเชฒ (variable) เชฎเชพเช‚ เชธเช‚เช—เซเชฐเชนเซ€ เชถเช•เซ‹.

General Tags

wp_head(), get_footer(), get_header(), get_sidebar(), get_search_form(), bloginfo(), wp_title(), single_post_title(), wp_footer(), comments_template(), add_theme_support(), get_template_directory_uri(), body_class()

These load reusable template parts, output <head>/footer hooks required by plugins, print site info (name, URL, description via bloginfo()), register theme features (add_theme_support('post-thumbnails')), and output dynamic CSS classes on the <body> tag.

Author Tags

the_author(), get_the_author(), the_author_link(), get_the_author_link(), the_author_meta(), the_author_posts() โ€” display the post author's name, profile link, custom meta (bio, website) and post count.

Category Tags

category_description(), single_cat_title(), the_category() โ€” output category descriptions, the current category archive title, and the list of categories a post belongs to.

Link Tags

the_permalink(), get_permalink(), home_url(), get_home_url(), site_url(), get_site_url() โ€” return/print canonical URLs for the current post or the site root.

Post Tags

the_content(), the_excerpt(), the_ID(), the_tags(), the_title(), get_the_title(), the_date(), get_the_date(), the_time(), next_post_link(), previous_post_link(), posts_nav_link(), post_class() โ€” the core set used inside the Loop to print a post's body, summary, ID, tags, title, date/time, pagination links between posts, and dynamic CSS classes on the post wrapper.

Post Thumbnail Tags

has_post_thumbnail(), get_post_thumbnail_id(), the_post_thumbnail(), get_the_post_thumbnail() โ€” check for and output the Featured Image (requires add_theme_support('post-thumbnails') in functions.php).

Navigation Menu Tag

wp_nav_menu( array('theme_location' => 'primary') ) โ€” outputs a menu previously registered with register_nav_menu() and assigned by the user under Appearance โ†’ Menus.

Conditional Tags

is_archive(), is_category(), is_front_page(), is_home(), is_page(), is_single(), is_search(), is_attachment(), is_active_sidebar() โ€” booleans used to branch template logic based on the type of page currently being viewed (e.g., show a different header on the front page).

<?php if ( is_front_page() ) : ?>
    <div class="hero">Welcome banner</div>
<?php elseif ( is_single() ) : ?>
    <div class="post-meta"><?php the_date(); ?></div>
<?php endif; ?>

4.4 functions.php

The functions.php file acts like a plugin built into the theme โ€” it runs automatically on every page load and is the standard place to register menus, widget areas, theme support, enqueue styles/scripts, and hook in custom PHP functions (covered further in Unit 5).

<?php
function mytheme_setup() {
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'title-tag' );
    register_nav_menu( 'primary', 'Primary Menu' );
}
add_action( 'after_setup_theme', 'mytheme_setup' );
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

functions.php เชถเชพ เชฎเชพเชŸเซ‡ เช–เชพเชธ เช›เซ‡? เช† เชซเชพเชˆเชฒ เชฅเซ€เชฎเชจเซ€ เช…เช‚เชฆเชฐ เชฐเชนเซ‡เชฒเซ€ "mini plugin" เชœเซ‡เชตเซ€ เช›เซ‡ โ€” เชคเซ‡ เชฆเชฐเซ‡เช• เชชเซ‡เชœ เชฒเซ‹เชก เชฅเชพเชฏ เชคเซเชฏเชพเชฐเซ‡ เช†เชชเซ‹เช†เชช เชšเชพเชฒเซ‡ เช›เซ‡. เชคเซ‡เชฎเชพเช‚ เชคเชฎเซ‡ เชฎเซ‡เชจเซ เชฐเชœเชฟเชธเซเชŸเชฐ เช•เชฐเซ€ เชถเช•เซ‹, เชฅเซ€เชฎเชจเชพ เชซเซ€เชšเชฐเซเชธ เชšเชพเชฒเซ เช•เชฐเซ€ เชถเช•เซ‹ (เชœเซ‡เชฎ เช•เซ‡ Featured Image), เช…เชจเซ‡ เชชเซ‹เชคเชพเชจเชพ เช•เชธเซเชŸเชฎ เชซเช‚เช•เซเชถเชจ เชฌเชจเชพเชตเซ€ เชถเช•เซ‹ โ€” เช† เชฌเชงเซเช‚ wp-content เชจเซ€ เชฌเชนเชพเชฐ เช•เช‚เชˆ เชซเซ‡เชฐเชซเชพเชฐ เช•เชฐเซเชฏเชพ เชตเช—เชฐ.

๐Ÿงช Unit 4 โ€” Lab Practicals

  1. Build a theme from scratch with style.css, index.php, header.php, footer.php, sidebar.php.
  2. Write the Loop in index.php to list all posts with title, excerpt, and date.
  3. Create single.php and page.php with distinct layouts using conditional tags.
  4. Register a navigation menu in functions.php and output it with wp_nav_menu().
  5. Add Featured Image support and display it using the_post_thumbnail() on single.php.
  6. Use is_front_page(), is_single(), is_page() to conditionally change layout/markup.

5Advanced Development

5.1 Advanced Functions โ€” Hooks & Shortcodes

Actions vs Filters diagram
Fig 5.1 โ€” Action hooks run code; filter hooks modify and return data
FunctionPurpose
add_action( $hook, $callback )Attaches a custom function to run when WordPress reaches a specific point (e.g. init, wp_enqueue_scripts)
add_filter( $hook, $callback )Attaches a function that receives a value, modifies it, and must return it (e.g. altering the_title)
add_shortcode( $tag, $callback )Registers a reusable [shortcode] that editors can insert into post/page content
do_shortcode( $content )Manually parses and executes shortcodes inside a string (useful in template files)
register_nav_menu( $location, $desc )Declares a menu location a theme supports, so it appears under Appearance โ†’ Menus
// Custom shortcode: [greet name="Alpesh"]
function greet_shortcode( $atts ) {
    $atts = shortcode_atts( array( 'name' => 'Guest' ), $atts );
    return "Hello, " . esc_html( $atts['name'] ) . "!";
}
add_shortcode( 'greet', 'greet_shortcode' );

// Filter example: force all titles to uppercase
add_filter( 'the_title', function( $title ) {
    return strtoupper( $title );
});
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Action Hook vs Filter Hook เชจเซ‹ เชซเชฐเช•: Action Hook (add_action) เช "เช•เช‚เชˆเช• เช•เชฐเชตเชพ" เชฎเชพเชŸเซ‡ เชตเชชเชฐเชพเชฏ เช›เซ‡ โ€” เชœเซ‡เชฎ เช•เซ‡ เชˆเชฎเซ‡เชฒ เชฎเซ‹เช•เชฒเชตเซ‹, เชกเซ‡เชŸเชพ เชธเซ‡เชต เช•เชฐเชตเซ‹. เชคเซ‡ เช•เช‚เชˆ เชชเชพเช›เซเช‚ (return) เชจเชฅเซ€ เช†เชชเชคเซเช‚.

Filter Hook (add_filter) เช "เช•เซ‹เชˆ เชตเซ‡เชฒเซเชฏเซ เชฌเชฆเชฒเชตเชพ" เชฎเชพเชŸเซ‡ เชตเชชเชฐเชพเชฏ เช›เซ‡ โ€” เชคเซ‡ เชเช• เชตเซ‡เชฒเซเชฏเซ เชฒเซ‡ เช›เซ‡, เชคเซ‡เชฎเชพเช‚ เชซเซ‡เชฐเชซเชพเชฐ เช•เชฐเซ‡ เช›เซ‡, เช…เชจเซ‡ เชซเชฐเชœเชฟเชฏเชพเชค เชชเชพเช›เซ€ (return) เช†เชชเชตเซ€ เชชเชกเซ‡ เช›เซ‡. เชฆเชพ.เชค. เชชเซ‹เชธเซเชŸเชจเซเช‚ เชŸเชพเชˆเชŸเชฒ เชฎเซ‹เชŸเชพ เช…เช•เซเชทเชฐเซ‹เชฎเชพเช‚ เชฌเชคเชพเชตเชตเซเช‚.

เชธเชนเซ‡เชฒเซ€ เชฐเซ€เชคเซ‡: Action = "เช•เช‚เชˆเช• เช•เชฐเซ‹", Filter = "เช•เช‚เชˆเช• เชฌเชฆเชฒเซ€เชจเซ‡ เชชเชพเช›เซเช‚ เช†เชชเซ‹".

5.2 Custom Post Types & Taxonomies

Custom Post Type and Taxonomy relationship diagram
Fig 5.2 โ€” A Custom Post Type linked to a custom Taxonomy

A Custom Post Type (CPT) lets you model content beyond posts/pages โ€” e.g., "Movies," "Products," "Events." A Custom Taxonomy lets you classify that content โ€” e.g., "Genre" for Movies.

// Register a "Movie" Custom Post Type
function register_movie_cpt() {
    register_post_type( 'movie', array(
        'labels' => array( 'name' => 'Movies', 'singular_name' => 'Movie' ),
        'public' => true,
        'has_archive' => true,
        'supports' => array( 'title', 'editor', 'thumbnail' ),
        'menu_icon' => 'dashicons-video-alt2',
    ));
}
add_action( 'init', 'register_movie_cpt' );

// Register a "Genre" taxonomy for Movies
function register_genre_taxonomy() {
    register_taxonomy( 'genre', 'movie', array(
        'label' => 'Genre',
        'hierarchical' => true,
        'public' => true,
    ));
}
add_action( 'init', 'register_genre_taxonomy' );

Displaying a CPT & its taxonomy: create archive-movie.php (list view, uses the normal Loop against the CPT), single-movie.php (detail view), and taxonomy-genre.php (genre archive) โ€” WordPress' Template Hierarchy automatically picks these files up.

เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

Custom Post Type (CPT) เช…เชจเซ‡ Taxonomy เชถเซเช‚ เช›เซ‡? เชธเชพเชฎเชพเชจเซเชฏ เชฐเซ€เชคเซ‡ WordPress เชฎเชพเช‚ เชซเช•เซเชค "Post" เช…เชจเซ‡ "Page" เชœ เชนเซ‹เชฏ เช›เซ‡. เชชเชฃ เชœเซ‹ เชคเชฎเชพเชฐเซ‡ "Movie", "Product" เช•เซ‡ "Event" เชœเซ‡เชตเซ‹ เช…เชฒเช— เชชเซเชฐเช•เชพเชฐเชจเซ‹ เช•เชจเซเชŸเซ‡เชจเซเชŸ เชฌเชจเชพเชตเชตเซ‹ เชนเซ‹เชฏ, เชคเซ‹ register_post_type() เชตเชพเชชเชฐเซ€เชจเซ‡ เชชเซ‹เชคเชพเชจเซ‹ Custom Post Type เชฌเชจเชพเชตเซ€ เชถเช•เชพเชฏ.

Taxonomy เช CPT เชจเซ‡ เชตเชฐเซเช—เซ€เช•เซƒเชค (categorize) เช•เชฐเชตเชพเชจเซ€ เชฐเซ€เชค เช›เซ‡ โ€” เชœเซ‡เชฎ เช•เซ‡ "Movie" เชฎเชพเชŸเซ‡ "Genre" (Action, Comedy, Drama) โ€” เช† register_taxonomy() เชตเชกเซ‡ เชฌเชจเซ‡ เช›เซ‡. เชŸเซ‚เช‚เช•เชฎเชพเช‚: CPT = เชจเชตเซ‹ เช•เชจเซเชŸเซ‡เชจเซเชŸ เชชเซเชฐเช•เชพเชฐ, Taxonomy = เช เช•เชจเซเชŸเซ‡เชจเซเชŸเชจเซ‡ เช—เซ‹เช เชตเชตเชพเชจเซ€ เชฐเซ€เชค.

5.3 Widget Areas โ€” register_sidebar() & dynamic_sidebar()

// Register a custom widget area in functions.php
function mytheme_widgets_init() {
    register_sidebar( array(
        'name'          => 'Footer Widget Area',
        'id'            => 'footer-widgets',
        'before_widget' => '<div class="widget">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3>',
        'after_title'   => '</h3>',
    ));
}
add_action( 'widgets_init', 'mytheme_widgets_init' );

// Output the widget area in footer.php
<?php if ( is_active_sidebar( 'footer-widgets' ) ) : ?>
    <?php dynamic_sidebar( 'footer-widgets' ); ?>
<?php endif; ?>
Rendered footer widget area from dynamic_sidebar
Fig 5.3 โ€” Output of the code above on the front end
เช—เซเชœเชฐเชพเชคเซ€เชฎเชพเช‚ เชธเชฎเชœ

register_sidebar() เช…เชจเซ‡ dynamic_sidebar() เชจเซ‹ เชซเชฐเช•: register_sidebar() เช เชจเชตเซ‹ widget area เชฌเชจเชพเชตเชตเชพ เชฎเชพเชŸเซ‡ เชตเชชเชฐเชพเชฏ เช›เซ‡ โ€” เชคเซ‡ functions.php เชฎเชพเช‚ เชซเช•เซเชค เชเช• เชœ เชตเชพเชฐ เชฒเช–เชพเชฏ เช›เซ‡, เชœเซ‡เชฎ เช•เซ‡ "Footer Widget Area" เชœเชพเชนเซ‡เชฐ เช•เชฐเชตเซเช‚.

dynamic_sidebar() เช เชชเซ‡เชฒเชพ area เชฎเชพเช‚ เชฏเซเชเชฐเซ‡ เชœเซ‡ widgets เชฎเซ‚เช•เซเชฏเชพ เชนเซ‹เชฏ เช เช–เชฐเซ‡เช–เชฐ เช›เชพเชชเชตเชพ เชฎเชพเชŸเซ‡ เชตเชชเชฐเชพเชฏ เช›เซ‡ โ€” เชคเซ‡ footer.php เช•เซ‡ sidebar.php เชœเซ‡เชตเซ€ เชŸเซ‡เชฎเซเชชเชฒเซ‡เชŸ เชซเชพเชˆเชฒเชฎเชพเช‚ เชฒเช–เชพเชฏ เช›เซ‡. เชŸเซ‚เช‚เช•เชฎเชพเช‚: register = เชœเช—เซเชฏเชพ เชฌเชจเชพเชตเซ‹, dynamic_sidebar = เช เชœเช—เซเชฏเชพเชจเซเช‚ เช•เชจเซเชŸเซ‡เชจเซเชŸ เชฌเชคเชพเชตเซ‹.

๐Ÿงช Unit 5 โ€” Lab Practicals

  1. Register a custom shortcode and use it inside a page's content.
  2. Write a filter that modifies post excerpts (e.g., custom "Read more" text).
  3. Create a "Testimonial" Custom Post Type with a "Rating" custom taxonomy.
  4. Build archive-testimonial.php and single-testimonial.php templates to display it.
  5. Register a new widget area ("Footer Widgets") and display it with dynamic_sidebar().
  6. Combine add_action + register_nav_menu to add a secondary "Footer Menu" location.

18CS-18 ยท Consolidated Practical / Lab List

CS-18 is the dedicated MDC practical paper covering CS-15 (C++ OOP), CS-16 (RDBMS/Oracle) and CS-17 (WordPress). The WordPress-specific practical checklist below consolidates the unit-wise practicals above into an exam-ready sequence:

  1. Install WordPress locally using XAMPP and phpMyAdmin.
  2. Create posts/pages using various Gutenberg blocks; manage categories & tags.
  3. Manage the Media Library โ€” upload, edit metadata, insert into content.
  4. Create and test multiple user roles and their capabilities.
  5. Install, activate, and customize a theme (logo, menu, homepage, custom CSS).
  6. Add and arrange widgets; observe inactive-widget behaviour on theme switch.
  7. Install and configure at least 3 plugins (SEO, contact form, and one more of choice).
  8. Build a custom theme from scratch: style.css, header.php, footer.php, sidebar.php, index.php, single.php, page.php.
  9. Implement the Loop and at least 6 different template tags across templates.
  10. Register a custom navigation menu and a custom widget area via functions.php.
  11. Create a custom shortcode and a custom filter.
  12. Register a Custom Post Type with a Custom Taxonomy and build its archive/single templates.

๐Ÿ“Exam Pattern & Model Question Paper

Based on the official Saurashtra University BCA (Honours) evaluation scheme, CS-17 carries 50 CCE (internal) + 50 SEE (semester-end) = 100 total marks. Internal/unit tests generally follow this structure (25 marks per test, covering 2โ€“3 units at a time):

QuestionInstructionMarks
Q.1Attempt any TWO of the following (Unit 1)10
Q.2Attempt any TWO of the following (Unit 2 / relevant unit)10
Q.3Attempt any ONE of the following (Unit 3 / relevant unit)05

The Semester-End Exam (SEE) typically extends this pattern across all 5 units for the full 50 marks, mixing short-answer, descriptive, and practical/coding-based questions (writing template tag code, explaining hooks, designing a CPT, etc.).

๐Ÿ“ Note: This is a representative structure based on the official syllabus and university exam pattern, built for revision purposes โ€” always cross-check the exact question paper format with your department/current exam circular before the exam.

โ“Important Exam-Oriented Questions & Answers

Short Answer Type (2 marks each โ€” good for Q1/Q2 style)

2 marks
Q1. What is a CMS? Give one example.
A Content Management System lets users create/manage digital content through a dashboard without coding each page. Example: WordPress.
2 marks
Q2. Differentiate between a Post and a Page.
Posts are time-based, chronological, support categories/tags (used for blogs/news). Pages are static, hierarchical, standalone content (About, Contact) without categories/tags.
2 marks
Q3. What is the difference between a Category and a Tag?
Categories are hierarchical (broad topics with parent/child); Tags are flat, non-hierarchical keywords for cross-referencing specific details.
2 marks
Q4. What is a Widget?
A drag-and-drop content block (e.g., Search, Recent Posts) placed into a theme's widget area without coding.
2 marks
Q5. What is a Plugin? Give two examples.
A packaged PHP add-on that extends WordPress functionality without editing core files. Examples: Yoast SEO, Contact Form 7.
2 marks
Q6. What is the Loop in WordPress?
The PHP construct using have_posts() and the_post() that iterates through queried posts and outputs each one using template tags.
2 marks
Q7. What is the difference between an Action hook and a Filter hook?
An action (add_action/do_action) runs custom code at a point in execution and returns nothing; a filter (add_filter/apply_filters) receives a value, modifies it, and must return the modified value.
2 marks
Q8. What is a Custom Post Type?
A user-defined content type (beyond default Posts/Pages) registered with register_post_type(), e.g. "Product" or "Movie," used to model structured content.
2 marks
Q9. What is the WordPress Template Hierarchy?
The priority order WordPress follows to pick the right template file for a given request โ€” from most specific (e.g. single-movie.php) down to the universal fallback index.php.
2 marks
Q10. What happens to widgets when you switch to a theme with fewer widget areas?
They are automatically moved to the "Inactive Widgets" area rather than deleted, so they can be restored later.

Long Answer / Descriptive Type (5 marks each โ€” good for Q3 style)

5 marks
Q11. Explain the WordPress directory structure in detail.
Covers wp-admin (dashboard core), wp-includes (core libraries), wp-content (themes, plugins, uploads โ€” the only folder meant for customization), wp-config.php (DB credentials/security keys), and .htaccess (permalink rewrite rules). See Fig 1.1.
5 marks
Q12. Describe the anatomy of a WordPress theme along with its required and optional template files.
A theme minimally needs style.css (metadata + CSS) and index.php (fallback template). Optional but common files include header.php, footer.php, sidebar.php, single.php, page.php, archive.php, search.php, comments.php, 404.php, and functions.php, all working together via the Template Hierarchy. See Fig 4.1 & Fig 4.2.
5 marks
Q13. Explain the Loop with a code example.
The Loop wraps a while(have_posts()) block calling the_post() each iteration to set up global post data, followed by template tags like the_title() and the_content() to output content. See section 4.2 code sample and Fig 4.3.
5 marks
Q14. Explain Template Tags with categories and examples.
Template tags are PHP functions used inside theme files to output dynamic content: General (get_header(), bloginfo()), Author (the_author()), Category (the_category()), Link (the_permalink()), Post (the_title(), the_content()), Post Thumbnail (the_post_thumbnail()), Navigation Menu (wp_nav_menu()), and Conditional tags (is_single(), is_page()).
5 marks
Q15. How do you register and display a Custom Post Type with a Custom Taxonomy? Explain with code.
Use register_post_type() hooked to 'init' to define the CPT (labels, supports, has_archive), and register_taxonomy() to define a classification for it. Display it using archive-{posttype}.php / single-{posttype}.php / taxonomy-{taxonomy}.php, which the Template Hierarchy automatically loads. See section 5.2 code sample and Fig 5.2.
5 marks
Q16. Explain how to create and register a Widget Area, and how to display it in a theme.
Call register_sidebar() inside a function hooked to 'widgets_init' in functions.php, specifying id, before/after widget and title wrappers. Then call dynamic_sidebar('id') inside the template file (commonly footer.php or sidebar.php), typically wrapped in is_active_sidebar() to avoid empty markup. See section 5.3 and Fig 5.3.
5 marks
Q17. Explain the WordPress database structure with major tables.
wp_posts stores posts/pages/CPTs; wp_postmeta stores custom field data; wp_users/wp_usermeta store accounts and their meta; wp_terms, wp_term_taxonomy, wp_term_relationships together implement categories/tags/custom taxonomies; wp_comments/wp_commentmeta store comments; wp_options stores site-wide settings. See Fig 1.8.

Practical / Coding-Based

Q18. Write PHP code to register a custom shortcode that displays a welcome message.
See the add_shortcode() example in section 5.1 โ€” register with add_shortcode('greet', 'greet_shortcode') and return the output string from the callback (never echo directly).
Q19. Write code to register a navigation menu and display it in header.php.
register_nav_menu('primary', 'Primary Menu') hooked to after_setup_theme, then wp_nav_menu(array('theme_location' => 'primary')) inside header.php.
Q20. Write a conditional-tag example that shows a hero banner only on the homepage.
if ( is_front_page() ) { echo '<div class="hero">...</div>'; } โ€” see section 4.3 conditional tag example.

โšกQuick-Revision Flashcards

CMS
Software to create/manage digital content without coding each page.
Theme
Controls presentation/layout of stored content.
Plugin
PHP add-on that extends functionality without editing core.
Widget
Drag-and-drop content block placed in a widget area.
The Loop
have_posts() + the_post() cycle that outputs queried posts.
Template Tag
PHP function used in theme files to output dynamic content.
Conditional Tag
Boolean function (is_single(), is_page()) to branch template logic.
Action Hook
add_action() โ€” runs custom code at a specific point; no return value.
Filter Hook
add_filter() โ€” modifies a value and must return it.
Shortcode
[tag] inserted in content, parsed by add_shortcode() callback.
Custom Post Type
register_post_type() โ€” models content beyond posts/pages.
Custom Taxonomy
register_taxonomy() โ€” classification scheme for a post type.
Template Hierarchy
Priority order WP uses to pick a template file, ending at index.php.
functions.php
Theme's built-in "plugin" file โ€” hooks, menus, theme support.
wp_nav_menu()
Outputs a registered + user-assigned navigation menu.
register_sidebar()
Declares a new widget area in functions.php.
dynamic_sidebar()
Outputs the widgets placed in a registered widget area.
Permalink
URL structure for content; "Post name" is SEO-recommended.

๐Ÿ“‹Full Syllabus Summary

Unit 1 โ€” Introduction, Installation & Configuration

CMS/WordPress fundamentals, features, pros/cons, local & live installation, directory structure, dashboard, content (posts/pages/media), Gutenberg blocks, user roles, core settings, updates, database structure.

Unit 2 โ€” Theme

What a theme is, install/activate flow, and all five Customizer panels (Site Identity, Menus, Widgets, Homepage Settings, Additional CSS).

Unit 3 โ€” Widget & Plugin

Widgets/widget areas, widget management, inactive widgets; what a plugin is, install/activate flow, and commonly used plugins (SEO, forms, e-commerce, caching, ACF).

Unit 4 โ€” Theme Development

Theme anatomy, all template files, the Template Hierarchy, the Loop, and the full set of template tags (General, Author, Category, Link, Post, Post Thumbnail, Navigation Menu, Conditional) plus functions.php.

Unit 5 โ€” Advanced Development

Hooks (add_action/add_filter), shortcodes (add_shortcode/do_shortcode), register_nav_menu(), Custom Post Types + Taxonomies (register_post_type/register_taxonomy), and custom widget areas (register_sidebar/dynamic_sidebar).

๐ŸŽฏ Exam strategy: Prioritize the Loop, Template Tags, Hooks (actions vs. filters), and Custom Post Type registration code โ€” these appear most frequently as both theory and coding questions.

๐Ÿ“šReferences

  • Sarah McHarry โ€” WordPress to Go: How to Build a WordPress Website on Your Own Domain, from Scratch, Even If You Are a Complete Beginner
  • Official WordPress Developer Resources โ€” developer.wordpress.org (Theme Handbook, Plugin Handbook, Template Tag reference)
  • WordPress Codex & wordpress.org documentation
  • Saurashtra University B.C.A. (Honours) & B.C.A. (Honours with Research) Syllabus, Semester 3 & 4, effective June 2024
โ†‘