-
Notifications
You must be signed in to change notification settings - Fork 0
Add Akshant News Pro WordPress theme starter and plugins guide #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Akshant News Pro - WordPress News Template | ||
|
|
||
| This repository now contains a full starter WordPress theme that follows a Hindi news portal layout similar in structure to major Indian news websites. | ||
|
|
||
| ## Branding included | ||
| - Developed By: **Akshant Media Solution** | ||
| - Owner: **Prashant Tiwari** | ||
|
|
||
| ## Folder | ||
| - `wp-content/themes/akshant-news` | ||
|
|
||
| ## Required / Jaruri Plugins | ||
| Install these plugins for a production-ready setup: | ||
|
|
||
| 1. **Classic Widgets** (easy sidebar control) | ||
| 2. **Yoast SEO** or **Rank Math SEO** (search optimization) | ||
| 3. **WP Super Cache** or **LiteSpeed Cache** (performance) | ||
| 4. **Web Stories** (visual story cards) | ||
| 5. **Smush** (image optimization) | ||
| 6. **UpdraftPlus** (backup) | ||
| 7. **Wordfence Security** (security) | ||
| 8. **Site Kit by Google** (analytics + search console) | ||
| 9. **Contact Form 7** (contact forms) | ||
| 10. **Polylang** (if you need multi-language) | ||
|
|
||
| ## Setup Steps | ||
| 1. Copy `wp-content/themes/akshant-news` to your WordPress installation. | ||
| 2. Go to **Appearance → Themes** and activate **Akshant News Pro**. | ||
| 3. Create a menu and assign it to **Primary Menu**. | ||
| 4. Add posts with featured images for homepage cards. | ||
| 5. Go to **Settings → Reading** and set a static homepage (Front Page). | ||
| 6. Install the plugins listed above. | ||
|
|
||
| ## Important note | ||
| This is a custom-built theme inspired by common news layouts. Do not copy proprietary logos, code, content, or trademarks from third-party websites. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // Placeholder for future interactions (ticker slider, sticky ads, etc.) | ||
| console.log('Akshant News Pro theme loaded'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php if (!defined('ABSPATH')) { exit; } ?> | ||
| <footer class="site-footer"> | ||
| <div class="container"> | ||
| <h3><?php bloginfo('name'); ?></h3> | ||
| <p class="footer-meta">Developed By Akshant Media Solution | Owner: Prashant Tiwari</p> | ||
| <p class="footer-meta">© <?php echo esc_html(date('Y')); ?> All rights reserved.</p> | ||
| </div> | ||
| </footer> | ||
| <?php wp_footer(); ?> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| <?php | ||
| if (!defined('ABSPATH')) { | ||
| exit; | ||
| } | ||
| get_header(); | ||
| ?> | ||
|
|
||
| <section class="breaking"> | ||
| <div class="container"><strong>Breaking:</strong> <?php bloginfo('description'); ?></div> | ||
| </section> | ||
|
|
||
| <main class="container"> | ||
| <?php | ||
| $hero_query = new WP_Query([ | ||
| 'posts_per_page' => 1, | ||
| 'ignore_sticky_posts' => true, | ||
| ]); | ||
|
|
||
| $side_query = new WP_Query([ | ||
| 'posts_per_page' => 5, | ||
| 'offset' => 1, | ||
| 'ignore_sticky_posts' => true, | ||
| ]); | ||
| ?> | ||
|
|
||
| <section class="news-grid"> | ||
| <div> | ||
| <?php if ($hero_query->have_posts()) : while ($hero_query->have_posts()) : $hero_query->the_post(); ?> | ||
| <article class="hero-card"> | ||
| <a href="<?php the_permalink(); ?>"> | ||
| <?php if (has_post_thumbnail()) { the_post_thumbnail('large'); } ?> | ||
| <h2><?php the_title(); ?></h2> | ||
| </a> | ||
| <p><?php echo esc_html(wp_trim_words(get_the_excerpt(), 28)); ?></p> | ||
| </article> | ||
| <?php endwhile; wp_reset_postdata(); endif; ?> | ||
| </div> | ||
|
|
||
| <div class="story-list"> | ||
| <?php if ($side_query->have_posts()) : while ($side_query->have_posts()) : $side_query->the_post(); ?> | ||
| <article class="story-card"> | ||
| <a href="<?php the_permalink(); ?>"> | ||
| <?php if (has_post_thumbnail()) { the_post_thumbnail('medium'); } ?> | ||
| <h3><?php the_title(); ?></h3> | ||
| </a> | ||
| </article> | ||
| <?php endwhile; wp_reset_postdata(); endif; ?> | ||
| </div> | ||
| </section> | ||
|
|
||
| <h2 class="section-title">ताज़ा खबरें</h2> | ||
| <section class="two-col"> | ||
| <?php | ||
| $latest = new WP_Query(['posts_per_page' => 6, 'offset' => 6]); | ||
| if ($latest->have_posts()) : | ||
| while ($latest->have_posts()) : $latest->the_post(); ?> | ||
| <article class="story-card"> | ||
| <a href="<?php the_permalink(); ?>"> | ||
| <?php if (has_post_thumbnail()) { the_post_thumbnail('medium'); } ?> | ||
| <h3><?php the_title(); ?></h3> | ||
| </a> | ||
| </article> | ||
| <?php endwhile; | ||
| wp_reset_postdata(); | ||
| endif; | ||
| ?> | ||
| </section> | ||
|
|
||
| <?php if (is_active_sidebar('homepage-sidebar')) : ?> | ||
| <aside><?php dynamic_sidebar('homepage-sidebar'); ?></aside> | ||
| <?php endif; ?> | ||
| </main> | ||
|
|
||
| <?php get_footer(); ?> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?php | ||
| /** | ||
| * Theme setup for Akshant News Pro. | ||
| */ | ||
|
|
||
| if (!defined('ABSPATH')) { | ||
| exit; | ||
| } | ||
|
|
||
| function akshant_news_setup() { | ||
| add_theme_support('title-tag'); | ||
| add_theme_support('post-thumbnails'); | ||
| add_theme_support('html5', ['search-form', 'comment-form', 'gallery', 'caption', 'style', 'script']); | ||
|
|
||
| register_nav_menus([ | ||
| 'primary' => __('Primary Menu', 'akshant-news'), | ||
| ]); | ||
| } | ||
| add_action('after_setup_theme', 'akshant_news_setup'); | ||
|
|
||
| function akshant_news_assets() { | ||
| wp_enqueue_style('akshant-news-style', get_stylesheet_uri(), [], '1.0.0'); | ||
| wp_enqueue_script('akshant-news-main', get_template_directory_uri() . '/assets/js/main.js', [], '1.0.0', true); | ||
| } | ||
| add_action('wp_enqueue_scripts', 'akshant_news_assets'); | ||
|
|
||
| function akshant_news_widgets_init() { | ||
| register_sidebar([ | ||
| 'name' => __('Homepage Sidebar', 'akshant-news'), | ||
| 'id' => 'homepage-sidebar', | ||
| 'description' => __('Widgets for homepage sidebar area.', 'akshant-news'), | ||
| 'before_widget' => '<section class="widget">', | ||
| 'after_widget' => '</section>', | ||
| 'before_title' => '<h3 class="section-title">', | ||
| 'after_title' => '</h3>', | ||
| ]); | ||
| } | ||
| add_action('widgets_init', 'akshant_news_widgets_init'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php if (!defined('ABSPATH')) { exit; } ?> | ||
| <!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(); ?> | ||
| <div class="top-strip"> | ||
| <div class="container"><?php echo esc_html(date_i18n('l, d M Y')); ?> | Developed by Akshant Media Solution</div> | ||
| </div> | ||
| <header class="site-header"> | ||
| <div class="container brand-row"> | ||
| <div class="site-title"><?php bloginfo('name'); ?></div> | ||
| <div class="footer-meta">Owner: Prashant Tiwari</div> | ||
| </div> | ||
| <nav class="container main-nav" aria-label="Main Navigation"> | ||
| <?php | ||
| wp_nav_menu([ | ||
| 'theme_location' => 'primary', | ||
| 'container' => false, | ||
| 'fallback_cb' => function() { | ||
| echo '<ul><li><a href="#">होम</a></li><li><a href="#">देश</a></li><li><a href="#">राज्य</a></li><li><a href="#">खेल</a></li><li><a href="#">मनोरंजन</a></li></ul>'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If no menu is assigned to Useful? React with 👍 / 👎. |
||
| } | ||
| ]); | ||
| ?> | ||
| </nav> | ||
| </header> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
| if (!defined('ABSPATH')) { | ||
| exit; | ||
| } | ||
| get_header(); | ||
| ?> | ||
| <main class="container"> | ||
| <h1 class="section-title"><?php single_post_title(); ?></h1> | ||
| <?php if (have_posts()) : while (have_posts()) : the_post(); ?> | ||
| <article <?php post_class('story-card'); ?> style="margin-bottom: 22px;"> | ||
| <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a> | ||
| <p><?php echo esc_html(wp_trim_words(get_the_excerpt(), 32)); ?></p> | ||
| </article> | ||
| <?php endwhile; else : ?> | ||
| <p><?php esc_html_e('No posts found.', 'akshant-news'); ?></p> | ||
| <?php endif; ?> | ||
| </main> | ||
| <?php get_footer(); ?> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
| if (!defined('ABSPATH')) { | ||
| exit; | ||
| } | ||
| get_header(); | ||
| ?> | ||
| <main class="container" style="max-width: 850px; padding-top: 20px;"> | ||
| <?php while (have_posts()) : the_post(); ?> | ||
| <article <?php post_class(); ?>> | ||
| <h1><?php the_title(); ?></h1> | ||
| <p class="footer-meta"><?php echo esc_html(get_the_date()); ?></p> | ||
| <?php if (has_post_thumbnail()) { the_post_thumbnail('large'); } ?> | ||
| <div><?php the_content(); ?></div> | ||
| </article> | ||
| <?php endwhile; ?> | ||
| </main> | ||
| <?php get_footer(); ?> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| Theme Name: Akshant News Pro | ||
| Theme URI: https://example.com/akshant-news-pro | ||
| Author: Akshant Media Solution | ||
| Author URI: https://example.com | ||
| Description: Hindi news portal style WordPress theme inspired by modern Indian news sites. Developed for Prashant Tiwari. | ||
| Version: 1.0.0 | ||
| Requires at least: 6.0 | ||
| Tested up to: 6.6 | ||
| Requires PHP: 7.4 | ||
| Text Domain: akshant-news | ||
| */ | ||
|
|
||
| :root { | ||
| --primary: #d90000; | ||
| --dark: #1a1a1a; | ||
| --gray: #f4f4f4; | ||
| --text: #222; | ||
| } | ||
|
|
||
| * { box-sizing: border-box; } | ||
| body { | ||
| margin: 0; | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| color: var(--text); | ||
| background: #fff; | ||
| } | ||
|
|
||
| a { color: inherit; text-decoration: none; } | ||
| .container { width: min(1200px, 92vw); margin: 0 auto; } | ||
|
|
||
| .top-strip { | ||
| background: var(--dark); | ||
| color: #fff; | ||
| font-size: 14px; | ||
| padding: 8px 0; | ||
| } | ||
|
|
||
| .site-header { | ||
| border-bottom: 1px solid #ddd; | ||
| position: sticky; | ||
| top: 0; | ||
| z-index: 999; | ||
| background: #fff; | ||
| } | ||
|
|
||
| .brand-row { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| padding: 14px 0; | ||
| } | ||
|
|
||
| .site-title { | ||
| font-size: 34px; | ||
| color: var(--primary); | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .main-nav ul { | ||
| list-style: none; | ||
| display: flex; | ||
| gap: 18px; | ||
| margin: 0; | ||
| padding: 0 0 12px; | ||
| overflow-x: auto; | ||
| } | ||
|
|
||
| .main-nav a { | ||
| font-weight: 600; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .breaking { | ||
| background: var(--gray); | ||
| border-top: 1px solid #ddd; | ||
| border-bottom: 1px solid #ddd; | ||
| padding: 10px 0; | ||
| } | ||
|
|
||
| .breaking strong { color: var(--primary); margin-right: 8px; } | ||
|
|
||
| .news-grid { | ||
| display: grid; | ||
| grid-template-columns: 2fr 1fr; | ||
| gap: 18px; | ||
| margin: 20px 0; | ||
| } | ||
|
|
||
| .hero-card img, | ||
| .story-card img { width: 100%; height: auto; display: block; border-radius: 8px; } | ||
|
|
||
| .hero-card h2 { margin-top: 10px; font-size: 32px; } | ||
| .story-list { display: grid; gap: 14px; } | ||
| .story-card h3 { margin: 8px 0 0; font-size: 18px; } | ||
|
|
||
| .section-title { | ||
| border-left: 5px solid var(--primary); | ||
| padding-left: 10px; | ||
| margin: 28px 0 12px; | ||
| font-size: 22px; | ||
| } | ||
|
|
||
| .two-col { | ||
| display: grid; | ||
| grid-template-columns: repeat(2, 1fr); | ||
| gap: 18px; | ||
| } | ||
|
|
||
| .site-footer { | ||
| margin-top: 40px; | ||
| background: var(--dark); | ||
| color: #fff; | ||
| padding: 28px 0; | ||
| } | ||
|
|
||
| .footer-meta { font-size: 14px; opacity: 0.9; } | ||
|
|
||
| @media (max-width: 900px) { | ||
| .news-grid, | ||
| .two-col { grid-template-columns: 1fr; } | ||
| .site-title { font-size: 28px; } | ||
| .hero-card h2 { font-size: 24px; } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "latest" section query omits
ignore_sticky_posts, while the hero and side queries explicitly set it to true. When a site has sticky posts, WordPress re-injects them at the top of this third query, which can duplicate stories already shown above and make theoffsetskip the wrong non-sticky posts. Addignore_sticky_posts => truehere to keep homepage sections consistent and non-overlapping.Useful? React with 👍 / 👎.