Saturday, September 20, 2025

#8 Make WP Theme

 Perfect ๐Ÿ‘ Let’s upgrade the minimal theme with all the “nice-to-have” Astra-like enhancements so it feels more professional, flexible, and future-proof.

I’ll keep code minimal, clean, and ready to drop into your theme folder.


✅ Enhanced Theme Structure

Your folder will now look like this:

my-astra-lite/
│── style.css
│── functions.php
│── header.php
│── footer.php
│── index.php
│── single.php
│── page.php
│── sidebar.php
│── screenshot.png
│── /assets
│     ├── js/navigation.js
│     └── css/block-editor-styles.css
│── /template-parts
│     └── content.php

1. style.css

(same header, add editor styles hint)

/*
Theme Name: My Astra Lite
Theme URI:  https://example.com/my-astra-lite
Author:      You
Author URI:  https://example.com
Description: A minimal Astra-like theme with modern enhancements.
Version:     1.1
License:     GPL-2.0-or-later
Text Domain: my-astra-lite
*/

/* frontend styles (same as before) */

/* --- Editor tweaks (block editor will import block-editor-styles.css) --- */

2. functions.php

(updated to include editor styles, proper JS enqueue, and template parts)

<?php
// Theme setup
function my_astra_lite_setup() {
    add_theme_support('title-tag');
    add_theme_support('post-thumbnails');
    add_theme_support('custom-logo', array(
        'height'      => 60,
        'width'       => 200,
        'flex-height' => true,
        'flex-width'  => true,
    ));
    add_theme_support('html5', array('search-form','comment-form','comment-list','gallery','caption'));
    add_theme_support('responsive-embeds');

    // Gutenberg block editor support
    add_theme_support('editor-styles');
    add_editor_style('assets/css/block-editor-styles.css');

    register_nav_menus(array(
        'primary' => __('Primary Menu', 'my-astra-lite'),
    ));
}
add_action('after_setup_theme', 'my_astra_lite_setup');

// Enqueue assets
function my_astra_lite_scripts() {
    wp_enqueue_style('my-astra-lite-style', get_stylesheet_uri(), array(), wp_get_theme()->get('Version'));
    wp_enqueue_script('my-astra-lite-nav', get_template_directory_uri().'/assets/js/navigation.js', array(), '1.0', true);
}
add_action('wp_enqueue_scripts', 'my_astra_lite_scripts');

// Sidebar
function my_astra_lite_widgets_init() {
    register_sidebar(array(
        'name'          => __('Sidebar', 'my-astra-lite'),
        'id'            => 'sidebar-1',
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ));
}
add_action('widgets_init','my_astra_lite_widgets_init');

3. header.php

(no major change, just streamlined)

<!doctype html>
<html <?php language_attributes(); ?>>
<head>
  <meta charset="<?php bloginfo('charset'); ?>">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<a class="skip-link" href="#content">Skip to content</a>

<header class="site-header">
  <div class="wrap">
    <div class="site-branding">
      <?php if (has_custom_logo()) {
          the_custom_logo();
      } else { ?>
        <a class="site-title" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
        <p class="site-description"><?php bloginfo('description'); ?></p>
      <?php } ?>
    </div>

    <button class="menu-toggle" aria-expanded="false" aria-controls="primary-menu">Menu</button>

    <nav class="main-nav" role="navigation">
      <?php
        wp_nav_menu(array(
          'theme_location'=>'primary',
          'container'=>false,
          'menu_class'=>'main-menu',
          'fallback_cb'=>'__return_false'
        ));
      ?>
    </nav>
  </div>
</header>

<main id="content" class="wrap">

4. footer.php

(same, but credits improved)

  </main>

  <footer class="site-footer">
    <div class="wrap">
      <div class="site-info">
        &copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?> |
        <?php _e('Powered by WordPress', 'my-astra-lite'); ?>
      </div>
    </div>
  </footer>

  <?php wp_footer(); ?>
</body>
</html>

5. template-parts/content.php

(cleaner article markup shared by index.php, single.php, etc.)

<article id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>
  <header class="entry-header">
    <?php
      if ( is_singular() ) {
        the_title('<h1 class="entry-title">','</h1>');
      } else {
        the_title('<h2 class="entry-title"><a href="'.esc_url(get_permalink()).'">','</a></h2>');
      }
    ?>
    <div class="entry-meta">
      <time datetime="<?php echo esc_attr(get_the_date('c')); ?>"><?php echo get_the_date(); ?></time>
      • <?php the_author_posts_link(); ?>
    </div>
  </header>

  <div class="entry-content">
    <?php
      if ( is_singular() ) {
        the_content();
      } else {
        if ( has_post_thumbnail() ) the_post_thumbnail('medium');
        the_excerpt();
      }
    ?>
  </div>
</article>

6. index.php

(use template part)

<?php get_header(); ?>

<div class="content-area">
  <main class="site-main" role="main">
    <?php if (have_posts()) : while (have_posts()) : the_post();
        get_template_part('template-parts/content');
      endwhile;

      the_posts_pagination(array(
        'mid_size' => 1,
        'prev_text' => __('← Prev','my-astra-lite'),
        'next_text' => __('Next →','my-astra-lite'),
      ));

    else :
      echo '<p>'.__('Nothing found.','my-astra-lite').'</p>';
    endif; ?>
  </main>

  <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>

7. single.php

<?php get_header(); ?>

<div class="content-area">
  <main class="site-main" role="main">
    <?php while (have_posts()) : the_post();
        get_template_part('template-parts/content');
        if ( comments_open() || get_comments_number() ) comments_template();
    endwhile; ?>
  </main>
  <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>

8. page.php

<?php get_header(); ?>

<div class="content-area">
  <main class="site-main" role="main">
    <?php while (have_posts()) : the_post();
        get_template_part('template-parts/content');
    endwhile; ?>
  </main>
  <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>

9. /assets/js/navigation.js

(tiny JS for menu toggle)

document.addEventListener('DOMContentLoaded', function(){
  const btn = document.querySelector('.menu-toggle');
  const nav = document.querySelector('.main-menu');
  if(btn && nav){
    btn.addEventListener('click', function(){
      const expanded = btn.getAttribute('aria-expanded') === 'true';
      btn.setAttribute('aria-expanded', !expanded);
      nav.style.display = expanded ? 'none' : 'flex';
    });
  }
});

10. /assets/css/block-editor-styles.css

(make block editor match frontend styles)

body.block-editor-page .editor-styles-wrapper {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  color: #222;
  line-height: 1.6;
  padding: 1rem;
  max-width: 720px;
  margin: auto;
}
.editor-styles-wrapper h1,
.editor-styles-wrapper h2,
.editor-styles-wrapper h3 {
  font-weight: 600;
}
.editor-styles-wrapper a { color:#0b74de; }

11. screenshot.png

Make an 880×660 PNG (e.g., just text “My Astra Lite”) so WordPress shows it under Appearance → Themes.



๐ŸŽฏ Final Outcome

  • ✅ Lightweight, fast Astra-like structure

  • ✅ Template parts for clean code

  • ✅ Sidebar & widgets

  • ✅ Custom Logo & Site Identity support

  • ✅ Gutenberg block editor styling

  • ✅ Responsive menu toggle with JS

  • ✅ Screenshot preview


๐Ÿ‘‰ Do you want me to package this whole theme into a ZIP (ready to upload & activate), or should I just keep giving the code file-by-file?

#7 Quick recapture

1.  Checklist:

Web site Building


install xampp

create db wp-db

install wordpress

    dashboard 

            remove all plugins

           screen option -uncheck to clear screen

           settings  - genereal - site title , tag line

                         - permalink structure - post %postname%


Theme 

        Dashboard - appearance -add new - Astra - install + activatge

        delete other themes

 plugins

        dashboard - add - Starter templates - install  + Activate

  pages

        dashboard - pages - add - template - 

        starter - build with template - see library - build with template -  elementor 

        PAGE - Template - page - search for starter template Nature


 

                            

Friday, September 19, 2025

#6 Website creation in minutes using Gravity write plugin

 Got it ✅ — you want a WordPress tutorial with prompts to guide you in using the GravityWrite plugin (an AI writing assistant for WordPress) to generate content and design a blue glassmorphic educational website with pages like Home, Projects, Tutorials, Contact Us, and Intern Labs.

Here’s a step-by-step tutorial with ready-to-use prompts:


๐Ÿ”น Step 1: Install GravityWrite Plugin

  1. Log in to your WordPress Dashboard.

  2. Go to Plugins → Add New.

  3. Search for GravityWrite → Install & Activate.

  4. Connect your GravityWrite account/API key.


๐Ÿ”น Step 2: Set the Website Theme

  • Use a glassmorphic design WordPress theme (e.g., Neve, Astra, or Kadence) and customize it with:

    • Background: gradient blues (navy → cyan).

    • Semi-transparent cards with blur (glassmorphism).

    • Rounded corners, shadows, and bold typography.


๐Ÿ”น Step 3: Create Pages

Go to Pages → Add New, and create the following:

  • Home

  • Projects

  • Tutorials

  • Contact Us

  • Intern Labs


๐Ÿ”น Step 4: Prompts for GravityWrite

Use these exact prompts inside GravityWrite (choose blog/article/website copy mode as needed):

๐Ÿ  Home Page Prompt

"Write a stunning home page introduction for an educational website called BlueVision Labs.
Theme: futuristic, blue glassmorphic design.
Include a hero tagline, short about section, and a call-to-action button for 'Explore Tutorials'.
Tone: inspiring, student-friendly, professional."


๐Ÿ“‚ Projects Page Prompt

"Generate engaging content for an Educational Projects page.
Describe 3–4 student-friendly projects (AI chatbot, Web App, IoT Smart Device, Data Visualization).
Each project should have a title, short description, and why students should try it.
Style: clear, motivating, and innovative."


๐Ÿ“˜ Tutorials Page Prompt

*"Write a structured Tutorials page for an education website.
Include sections for: Web Development, AI/ML Basics, Cloud Computing, and Open Source Tools.
Each tutorial section should have:

  1. Title

  2. Short introduction

  3. 3 bullet points on what learners will achieve.
    Tone: friendly, step-by-step, beginner-friendly."*


๐Ÿ“ž Contact Us Page Prompt

"Create professional but approachable Contact Us page content.
Include a short welcome note, support email, office address, and a friendly line encouraging students to reach out.
Add a motivational closing line like 'Let’s build the future together'."


๐Ÿงช Intern Labs Page Prompt

"Generate content for an Intern Labs page where students explore hands-on experiments.
Sections: 'Why Intern Labs?', 'What You’ll Learn', and 'Current Openings'.
Highlight skills like teamwork, real-world projects, and mentorship.
Tone: energetic, practical, and career-focused."


๐Ÿ”น Step 5: Add Stunning Images

  • Use free AI-generated images (Unsplash, Pexels, or GravityWrite image generator).

  • Prompts for images:

    • “Futuristic glassmorphic blue interface with education theme.”

    • “Students collaborating on tech projects in a modern digital lab.”

    • “Abstract blue gradient background with glass panels.”


๐Ÿ”น Step 6: Final Touch

  • Use Elementor or Gutenberg blocks with semi-transparent glass cards.

  • Add animations on hover (CSS blur + shadow).

  • Ensure site is mobile-friendly and fast.


๐Ÿ‘‰ Would you like me to also generate the full sample text outputs (as if GravityWrite wrote them) so you can copy-paste directly into your site?

Thursday, September 18, 2025

#5 Corrected Workshop Attendance

 Perfect ๐Ÿ‘ Let’s patch your Workshop Attendance plugin so the PDF downloads cleanly and always opens in Acrobat.

Below is a complete working version of the plugin file. I’ve replaced the PDF generation section with a safe generate_pdf() function that clears output buffering and sends correct headers.


๐Ÿ”น Fixed Plugin Code (workshop-attendance.php)

<?php
/*
Plugin Name: Workshop Attendance
Description: Manage workshop attendance and print certificates in PDF.
Version: 1.1
Author: You
*/

if (!defined('ABSPATH')) exit;

class Workshop_Attendance {
    private $table_name;

    public function __construct() {
        global $wpdb;
        $this->table_name = $wpdb->prefix . 'workshop_attendance';

        // Hooks
        register_activation_hook(__FILE__, [$this, 'install']);
        add_shortcode('workshop_form', [$this, 'form_page']);
        add_shortcode('workshop_list', [$this, 'list_page']);
        add_action('init', [$this, 'handle_form']);
    }

    /** Install DB + Pages */
    public function install() {
        $this->install_db();
        $this->create_pages();
    }

    private function install_db() {
        global $wpdb;
        $charset = $wpdb->get_charset_collate();

        $sql = "CREATE TABLE {$this->table_name} (
            id BIGINT(20) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(255) NOT NULL,
            institution VARCHAR(255) NOT NULL,
            department VARCHAR(255) NOT NULL,
            city VARCHAR(255) NOT NULL,
            date DATE NOT NULL,
            workshop VARCHAR(255) NOT NULL,
            photo VARCHAR(255) DEFAULT '',
            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
        ) $charset;";

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($sql);
    }

    private function create_pages() {
        $this->ensure_page('Workshop Registration', 'workshop-registration', '[workshop_form]');
        $this->ensure_page('Workshop Attendance List', 'workshop-attendance-list', '[workshop_list]');
    }

    private function ensure_page($title, $slug, $shortcode) {
        if (!get_page_by_path($slug)) {
            wp_insert_post([
                'post_title'   => $title,
                'post_name'    => $slug,
                'post_status'  => 'publish',
                'post_type'    => 'page',
                'post_content' => $shortcode,
            ]);
        }
    }

    /** Handle Form Submission */
    public function handle_form() {
        if (isset($_POST['wa_submit'])) {
            global $wpdb;

            // Upload photo
            $photo_url = '';
            if (!empty($_FILES['photo']['name'])) {
                require_once(ABSPATH . 'wp-admin/includes/file.php');
                $uploaded = wp_handle_upload($_FILES['photo'], ['test_form' => false]);
                if (!isset($uploaded['error'])) {
                    $photo_url = $uploaded['url'];
                }
            }

            $wpdb->insert($this->table_name, [
                'name'        => sanitize_text_field($_POST['name']),
                'institution' => sanitize_text_field($_POST['institution']),
                'department'  => sanitize_text_field($_POST['department']),
                'city'        => sanitize_text_field($_POST['city']),
                'date'        => sanitize_text_field($_POST['date']),
                'workshop'    => sanitize_text_field($_POST['workshop']),
                'photo'       => esc_url($photo_url),
            ]);

            wp_redirect(add_query_arg('success', '1', get_permalink()));
            exit;
        }
    }

    /** Registration Form */
    public function form_page() {
        ob_start();
        if (isset($_GET['success'])) {
            echo "<p style='color:green;'>Registration successful!</p>";
        }
        ?>
        <form method="post" enctype="multipart/form-data">
            <p><input type="text" name="name" placeholder="Name" required></p>
            <p><input type="text" name="institution" placeholder="Institution" required></p>
            <p><input type="text" name="department" placeholder="Department" required></p>
            <p><input type="text" name="city" placeholder="City" required></p>
            <p><input type="date" name="date" required></p>
            <p><input type="text" name="workshop" placeholder="Workshop" required></p>
            <p><input type="file" name="photo" accept="image/jpeg" required></p>
            <p><input type="submit" name="wa_submit" value="Register"></p>
        </form>
        <?php
        return ob_get_clean();
    }

    /** Attendance List + Print PDF */
    public function list_page() {
        global $wpdb;
        $entries = $wpdb->get_results("SELECT * FROM {$this->table_name} ORDER BY created_at DESC");

        // Handle PDF download
        if (isset($_GET['wa_pdf'])) {
            $entry_id = intval($_GET['wa_pdf']);
            $entry = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$this->table_name} WHERE id=%d", $entry_id));
            if ($entry) {
                $this->generate_pdf($entry);
            }
        }

        ob_start();
        ?>
        <h3>Workshop Attendance List</h3>
        <table border="1" cellpadding="5" cellspacing="0">
            <tr>
                <th>ID</th><th>Name</th><th>Institution</th><th>Department</th>
                <th>City</th><th>Date</th><th>Workshop</th><th>Photo</th><th>Action</th>
            </tr>
            <?php foreach ($entries as $e): ?>
            <tr>
                <td><?= esc_html($e->id) ?></td>
                <td><?= esc_html($e->name) ?></td>
                <td><?= esc_html($e->institution) ?></td>
                <td><?= esc_html($e->department) ?></td>
                <td><?= esc_html($e->city) ?></td>
                <td><?= esc_html($e->date) ?></td>
                <td><?= esc_html($e->workshop) ?></td>
                <td><?php if ($e->photo): ?><img src="<?= esc_url($e->photo) ?>" width="50"><?php endif; ?></td>
                <td><a href="?wa_pdf=<?= $e->id ?>" target="_blank">Print Certificate</a></td>
            </tr>
            <?php endforeach; ?>
        </table>
        <?php
        return ob_get_clean();
    }

    /** Generate Certificate PDF */
    private function generate_pdf($entry) {
        require_once __DIR__ . '/vendor/autoload.php';
        $dompdf = new Dompdf\Dompdf();

        $html = "
        <h2 style='text-align:center;'>Workshop Participation Certificate</h2>
        <p>This is to certify that <strong>{$entry->name}</strong> from 
        <strong>{$entry->institution}</strong>, Department of {$entry->department}, 
        City: {$entry->city}, has attended the <strong>{$entry->workshop}</strong> workshop 
        held on <strong>{$entry->date}</strong>.</p>
        ";

        if ($entry->photo) {
            $html .= "<p><img src='{$entry->photo}' width='100'></p>";
        }

        $dompdf->loadHtml($html, 'UTF-8');
        $dompdf->setPaper('A4', 'portrait');
        $dompdf->render();

        // Clean output buffer
        if (ob_get_length()) ob_end_clean();

        // Proper headers
        header('Content-Type: application/pdf');
        header('Content-Disposition: inline; filename="certificate.pdf"');
        echo $dompdf->output();
        exit;
    }
}

new Workshop_Attendance();

๐Ÿ”น What Changed

  • Added safe PDF output (clears buffers, correct headers).

  • Removed extra whitespace issues.

  • Ensures Acrobat opens the file (%PDF-1.7 at start, no HTML leaks).


✅ Drop this plugin file into wp-content/plugins/workshop-attendance/.
✅ Make sure you have Dompdf installed with Composer in the same folder:

cd C:\xampp\htdocs\wordpress\wp-content\plugins\workshop-attendance
composer require dompdf/dompdf

You’ll then get a /vendor/ folder.


Do you also want me to add Tamil text support in the certificate (Unicode fonts), so you can print bilingual certificates?

#4 Attendance

Perfect ✅ Let’s build a single-file WordPress plugin for your requirement.

This plugin will:

  1. Create a DB table for attendance.

  2. Provide a page with Registration Entry Form (Name, Institution, Department, City, Date, Workshop, Photo).

  3. Upload photos (only JPG < 100KB).

  4. Allow viewing entries and print PDF Certificates using Dompdf (bundled in WP plugin).


๐Ÿ”น Complete Single-File Plugin Code

Save this as workshop-attendance.php inside your wp-content/plugins/ folder. Then activate in WP Admin → Plugins.

<?php
/**
 * Plugin Name: Workshop Attendance & Certificates
 * Description: Manage workshop attendance with registration form and PDF certificate printing.
 * Version: 1.0
 * Author: OpenAI
 */

if (!defined('ABSPATH')) exit;

class Workshop_Attendance {
    private $table;

    public function __construct() {
        global $wpdb;
        $this->table = $wpdb->prefix . 'workshop_attendance';

        register_activation_hook(__FILE__, [$this, 'install']);
        add_shortcode('workshop_form', [$this, 'form_page']);
        add_shortcode('workshop_list', [$this, 'list_page']);
        add_action('init', [$this, 'handle_form']);
    }

    /** Create DB table */
    public function install() {
        global $wpdb;
        $charset = $wpdb->get_charset_collate();
        $sql = "CREATE TABLE {$this->table} (
            id BIGINT AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(200),
            institution VARCHAR(200),
            department VARCHAR(200),
            city VARCHAR(200),
            wdate DATE,
            workshop VARCHAR(200),
            photo VARCHAR(255),
            created_at DATETIME DEFAULT CURRENT_TIMESTAMP
        ) $charset;";
        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($sql);
    }

    /** Handle form submission */
    public function handle_form() {
        if (isset($_POST['wa_submit'])) {
            global $wpdb;

            // Photo validation
            if (!empty($_FILES['photo']['name'])) {
                $file = $_FILES['photo'];
                if ($file['type'] !== 'image/jpeg') {
                    wp_die('Only JPG images allowed');
                }
                if ($file['size'] > 100 * 1024) {
                    wp_die('File size must be less than 100KB');
                }
                $upload = wp_upload_bits($file['name'], null, file_get_contents($file['tmp_name']));
                if ($upload['error']) {
                    wp_die('Upload error: ' . $upload['error']);
                }
                $photo_url = $upload['url'];
            } else {
                $photo_url = '';
            }

            $wpdb->insert($this->table, [
                'name'        => sanitize_text_field($_POST['name']),
                'institution' => sanitize_text_field($_POST['institution']),
                'department'  => sanitize_text_field($_POST['department']),
                'city'        => sanitize_text_field($_POST['city']),
                'wdate'       => sanitize_text_field($_POST['wdate']),
                'workshop'    => sanitize_text_field($_POST['workshop']),
                'photo'       => $photo_url,
            ]);

            wp_redirect(add_query_arg('success', '1', get_permalink()));
            exit;
        }
    }

    /** Registration Form */
    public function form_page() {
        ob_start();
        if (isset($_GET['success'])) {
            echo '<p style="color:green;">✅ Registration saved successfully!</p>';
        }
        ?>
        <h2>Workshop Attendance Registration</h2>
        <form method="post" enctype="multipart/form-data">
            <p><input type="text" name="name" placeholder="Full Name" required></p>
            <p><input type="text" name="institution" placeholder="Institution" required></p>
            <p><input type="text" name="department" placeholder="Department" required></p>
            <p><input type="text" name="city" placeholder="City" required></p>
            <p><input type="date" name="wdate" required></p>
            <p><input type="text" name="workshop" placeholder="Workshop Title" required></p>
            <p>Upload Photo (JPG, <100KB): <input type="file" name="photo" accept="image/jpeg" required></p>
            <p><button type="submit" name="wa_submit">Submit</button></p>
        </form>
        <?php
        return ob_get_clean();
    }

    /** List & Certificates */
    public function list_page() {
        global $wpdb;
        $rows = $wpdb->get_results("SELECT * FROM {$this->table} ORDER BY created_at DESC");

        ob_start();
        ?>
        <h2>Workshop Attendance List</h2>
        <table border="1" cellpadding="6" cellspacing="0">
            <tr>
                <th>ID</th><th>Name</th><th>Institution</th><th>Dept</th><th>City</th><th>Date</th><th>Workshop</th><th>Photo</th><th>Certificate</th>
            </tr>
            <?php foreach ($rows as $r): ?>
            <tr>
                <td><?= $r->id ?></td>
                <td><?= esc_html($r->name) ?></td>
                <td><?= esc_html($r->institution) ?></td>
                <td><?= esc_html($r->department) ?></td>
                <td><?= esc_html($r->city) ?></td>
                <td><?= esc_html($r->wdate) ?></td>
                <td><?= esc_html($r->workshop) ?></td>
                <td><?php if ($r->photo): ?><img src="<?= esc_url($r->photo) ?>" width="60"><?php endif; ?></td>
                <td><a href="<?= add_query_arg(['wa_cert' => $r->id]) ?>" target="_blank">๐Ÿ–จ Print PDF</a></td>
            </tr>
            <?php endforeach; ?>
        </table>
        <?php

        // Certificate generation
        if (isset($_GET['wa_cert'])) {
            $id = intval($_GET['wa_cert']);
            $student = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$this->table} WHERE id=%d", $id));
            if ($student) {
                require_once __DIR__ . '/dompdf/autoload.inc.php';
                $dompdf = new Dompdf\Dompdf();
                $html = "
                <h2 style='text-align:center;'>Certificate of Participation</h2>
                <p style='text-align:center;'>This is to certify that <strong>{$student->name}</strong><br>
                from <strong>{$student->institution}</strong>, Department of {$student->department}, {$student->city}<br>
                has successfully attended the workshop <strong>{$student->workshop}</strong><br>
                held on {$student->wdate}.</p>";
                $dompdf->loadHtml($html);
                $dompdf->render();
                $dompdf->stream("certificate-{$student->id}.pdf");
                exit;
            }
        }

        return ob_get_clean();
    }
}

new Workshop_Attendance();

๐Ÿ”น How to Use

  1. Upload workshop-attendance.php into wp-content/plugins/.

  2. Also download Dompdf, extract, and place it inside wp-content/plugins/workshop-attendance/dompdf/.

  3. Activate plugin in WordPress.

  4. Create 2 pages:

    • Registration Form Page: put shortcode [workshop_form]

    • Attendance List Page (Admin): put shortcode [workshop_list]


✅ Now:

  • Students → fill the Attendance Form.

  • Admin → view Attendance List + click Print PDF for certificates.


Do you want me to also make the Certificates printable in Tamil + English (like Hall Ticket earlier)?

#3 site pages

 Prompt : 

I want to create home page in wordpress website with menu items for pages login, aboutus, projects with sub menu items attendance, equivalence, projectmonitor, contact us pages. can you give me steps

ChatGPT said:

Got it ๐Ÿ‘ You already have WordPress installed locally, now let’s build your homepage with menus and submenus step by step.


๐Ÿ› ️ Step 1: Create the Pages

  1. Log in to your WordPress admin:

    http://localhost/site1/wp-admin

    (replace site1 with your folder name).

  2. Go to Pages → Add New.

  3. Create these pages one by one:

    • Home

    • Login

    • About Us

    • Projects (this will be the parent menu item)

    • Attendance (submenu under Projects)

    • Equivalence (submenu under Projects)

    • Project Monitor (submenu under Projects)

    • Contact Us

๐Ÿ‘‰ Just publish them with some placeholder content for now.


๐Ÿ› ️ Step 2: Set Home Page

  1. Go to Settings → Reading.

  2. Under Your homepage displays, choose:

    • ✅ "A static page"

    • Select Home as Homepage.


๐Ÿ› ️ Step 3: Create the Menu

  1. Go to Appearance → Menus.

  2. Click Create a new menu, name it (e.g., Main Menu).

  3. Add all the pages you created (Home, Login, About Us, Projects, Attendance, Equivalence, Project Monitor, Contact Us).

  4. Drag them into order:

    • Home

    • Login

    • About Us

    • Projects

      • Attendance

      • Equivalence

      • Project Monitor

    • Contact Us

  5. Save Menu.


๐Ÿ› ️ Step 4: Assign the Menu to Your Site

  1. Still in Menus, check Primary Menu (or "Main Menu" depending on your theme).

  2. Save.


๐Ÿ› ️ Step 5: Add Menu to Homepage

Most themes automatically show the primary menu in the header.

  • If not, go to Appearance → Customize → Menus → Menu Locations → assign your new menu as Primary.


๐Ÿ› ️ Step 6: Customize Home Page Content

  1. Go to Pages → Home → Edit.

  2. Use the Block Editor (Gutenberg) or Customizer to add a welcome message, images, or a hero section.
    (Later you can install page builders like Elementor if you want advanced layouts).


✅ Now when you open your site (e.g., http://site1.local), you’ll see:

  • A Home Page with a navigation menu at the top.

  • Menu items: Home, Login, About Us, Projects (with dropdown: Attendance, Equivalence, Project Monitor), Contact Us.


๐Ÿ‘‰ Do you want me to also show you how to make the Login page functional (so users can log in from there instead of /wp-admin)?

#2 multiple wp sites

 Great question ๐Ÿ‘ Setting up multiple WordPress sites in the same XAMPP is very useful if you want to test many projects. You can do this in two ways:

  1. Simple way (different folders under htdocs)

  2. Professional way (virtual hosts with custom domain names like site1.local, site2.local)

I’ll explain both.


✅ Method 1: Simple way (easiest)

  1. Go to:

    C:\xampp\htdocs\
    
  2. Create a new folder for each WordPress project:

    C:\xampp\htdocs\project1
    C:\xampp\htdocs\project2
    
  3. Copy the WordPress files into each folder.

  4. Create a separate database for each project in phpMyAdmin:

    • wordpress_db1 for Project1

    • wordpress_db2 for Project2

  5. Install each site by visiting in browser:

    • http://localhost/project1

    • http://localhost/project2

⚡ That’s it. Each WordPress site is independent.


✅ Method 2: Virtual Hosts (cleaner, looks like real websites)

This way, you can use custom local domains instead of localhost/project1.

Step 1: Create project folders

Put your sites in htdocs:

C:\xampp\htdocs\site1
C:\xampp\htdocs\site2

Step 2: Create databases

  • site1_db for Site1

  • site2_db for Site2

Step 3: Edit httpd-vhosts.conf

  1. Open this file in Notepad (as Admin):

    C:\xampp\apache\conf\extra\httpd-vhosts.conf
    
  2. Add entries for each site:

    <VirtualHost *:80>
        ServerName site1.local
        DocumentRoot "C:/xampp/htdocs/site1"
        <Directory "C:/xampp/htdocs/site1">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerName site2.local
        DocumentRoot "C:/xampp/htdocs/site2"
        <Directory "C:/xampp/htdocs/site2">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    

Step 4: Edit hosts file

  1. Open (as Admin):

    C:\Windows\System32\drivers\etc\hosts
    
  2. Add:

    127.0.0.1   site1.local
    127.0.0.1   site2.local
    

Step 5: Restart Apache

  • Open XAMPP Control Panel → restart Apache.

Step 6: Install WordPress

Now you have multiple local sites running like real domains ๐ŸŽ‰


๐Ÿ‘‰ Do you want me to write a step-by-step full config file example for 2 WordPress sites (site1.local + site2.local), so you can copy-paste and run directly?

Perfect ๐Ÿ‘ I’ll give you a ready-to-use setup for 2 WordPress sites (site1.local and site2.local) inside XAMPP on Windows.


๐Ÿ”น Step 1: Create Site Folders

Go to:

C:\xampp\htdocs\

Create:

C:\xampp\htdocs\site1
C:\xampp\htdocs\site2

Unzip WordPress into both folders.


๐Ÿ”น Step 2: Create Databases

  1. Open http://localhost/phpmyadmin/

  2. Create 2 databases:

    • site1_db

    • site2_db


๐Ÿ”น Step 3: Configure Virtual Hosts

  1. Open (with Notepad as Admin):

    C:\xampp\apache\conf\extra\httpd-vhosts.conf
    
  2. Add this code at the bottom:

# Site1 Configuration
<VirtualHost *:80>
    ServerName site1.local
    DocumentRoot "C:/xampp/htdocs/site1"
    <Directory "C:/xampp/htdocs/site1">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

# Site2 Configuration
<VirtualHost *:80>
    ServerName site2.local
    DocumentRoot "C:/xampp/htdocs/site2"
    <Directory "C:/xampp/htdocs/site2">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

✅ Make sure the paths match your real folder names.


๐Ÿ”น Step 4: Map Domains in hosts File

  1. Open (as Admin):

    C:\Windows\System32\drivers\etc\hosts
    
  2. Add at the end:

127.0.0.1   site1.local
127.0.0.1   site2.local

๐Ÿ”น Step 5: Restart Apache

  • Open XAMPP Control Panel → Stop & Start Apache.


๐Ÿ”น Step 6: Install WordPress

Install each site normally → set username, password, and site title.


✅ Now you have two completely separate WordPress sites on your local system:


๐Ÿ‘‰ Do you want me to also give you a template for adding more sites (site3, site4, etc.), so you can just copy-paste when needed?

#1 installation

 Perfect ๐Ÿ‘Œ Since you’re on Windows, let’s keep it simple and stick with XAMPP + WordPress. Here’s a clear step-by-step:


๐Ÿ–ฅ️ Step 1: Install XAMPP

  1. Go to ๐Ÿ‘‰ https://www.apachefriends.org/download.html

  2. Download the latest XAMPP for Windows.

  3. Run the installer → choose default settings (installation path will be C:\xampp).

  4. After install, open XAMPP Control Panel → click Start for:

    • Apache

    • MySQL

(They should turn green ✅)


๐Ÿ—„️ Step 2: Create a Database

  1. Open your browser → http://localhost/phpmyadmin/.

  2. Click Databases tab.

  3. Type a database name (e.g., wordpress_db) → click Create.


๐Ÿ“‚ Step 3: Download WordPress

  1. Download from ๐Ÿ‘‰ https://wordpress.org/download/.

  2. Extract the ZIP file.

  3. Copy the wordpress folder to:

    C:\xampp\htdocs\
    

    (you can rename it, e.g., mywordpress)


๐ŸŒ Step 4: Run WordPress Installer

  1. In browser, go to:

    http://localhost/wordpress
    

    or (if renamed):

    http://localhost/mywordpress
    
  2. Select language → click Continue.

  3. Enter database info:

    • Database Name: wordpress_db

    • Username: root

    • Password: (leave blank)

    • Host: localhost

    • Table Prefix: wp_

  4. Click SubmitRun the installation.


๐Ÿ‘ค Step 5: Set Up Admin

  1. Fill in:

    • Site Title

    • Username (e.g., admin)

    • Password

    • Email

  2. Click Install WordPress.

  3. Once done → log in at:

    http://localhost/wordpress/wp-admin
    

Use your username + password.


๐ŸŽ‰ Done! WordPress is now running locally on your Windows machine. You can install themes, plugins, or even build your own.

๐Ÿ‘‰ Do you want me to also show you how to set up multiple WordPress sites inside the same XAMPP (so you can test many projects)?

#8 Make WP Theme

 Perfect ๐Ÿ‘ Let’s upgrade the minimal theme with all the “nice-to-have” Astra-like enhancements so it feels more professional, flexible, an...