Entertainment news codebase wordpress theme
Here's a basic codebase for a WordPress theme focused on entertainment news:
Theme Name: Entertainment News
Theme Description: A modern and sleek WordPress theme designed specifically for entertainment news websites. This theme features a responsive design, customizable layout, and a range of widgets to help you showcase your content.
Theme Files:
style.css
: The main stylesheet for the theme.functions.php
: The file that contains the theme's functions and hooks.header.php
: The file that contains the theme's header section.footer.php
: The file that contains the theme's footer section.index.php
: The file that contains the theme's main content area.page.php
: The file that contains the theme's page template.single.php
: The file that contains the theme's single post template.category.php
: The file that contains the theme's category template.archive.php
: The file that contains the theme's archive template.search.php
: The file that contains the theme's search results template.sidebar.php
: The file that contains the theme's sidebar template.widgets.php
: The file that contains the theme's widget functions.
Theme Code:
style.css:
/* Global Styles */
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
background-color: #f9f9f9;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
color: #333;
}
h1 {
font-size: 36px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 12px;
}
/* Header Styles */
header {
background-color: #333;
color: #fff;
padding: 1em;
text-align: center;
}
header h1 {
font-size: 24px;
margin: 0;
}
/* Footer Styles */
footer {
background-color: #333;
color: #fff;
padding: 1em;
text-align: center;
clear: both;
}
/* Main Content Styles */
main {
display: flex;
flex-direction: column;
align-items: center;
padding: 2em;
}
main article {
background-color: #fff;
padding: 2em;
border: 1px solid #ddd;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-bottom: 2em;
}
main article h2 {
font-size: 18px;
margin-top: 0;
}
main article p {
font-size: 16px;
margin-bottom: 1em;
}
/* Sidebar Styles */
aside {
width: 20%;
float: left;
padding: 2em;
background-color: #f9f9f9;
border: 1px solid #ddd;
}
aside h3 {
font-size: 16px;
margin-top: 0;
}
aside ul {
list-style: none;
padding: 0;
margin: 0;
}
aside li {
padding: 0.5em;
border-bottom: 1px solid #ddd;
}
aside li:last-child {
border-bottom: none;
}
/* Responsive Styles */
@media only screen and (max-width: 768px) {
main {
flex-direction: column;
}
main article {
width: 100%;
}
aside {
width: 100%;
float: none;
}
}
functions.php:
<?php
// Register theme functions
function entertainment_news_theme_functions() {
// Register theme styles
wp_register_style( 'entertainment-news-style', get_template_directory_uri(). '/style.css' );
// Register theme scripts
wp_register_script( 'entertainment-news-script', get_template_directory_uri(). '/js/script.js', array( 'jquery' ) );
// Enqueue theme styles and scripts
wp_enqueue_style( 'entertainment-news-style' );
wp_enqueue_script( 'entertainment-news-script' );
}
add_action( 'wp_enqueue_scripts', 'entertainment_news_theme_functions' );
// Register theme widgets
function entertainment_news_widgets() {
register_sidebar( array(
'name' => __( 'Sidebar', 'entertainment-news' ),
'id' => 'sidebar',
'description' => __( 'Add widgets to this sidebar', 'entertainment-news' ),
) );
}
add_action( 'widgets_init', 'entertainment_news_widgets' );
// Register theme menus
function entertainment_news_menus() {
register_nav_menu( 'header-menu', __( 'Header Menu', 'entertainment-news' ) );
}
add_action( 'init', 'entertainment_news_menus' );
?>
header.php:
<?php
/**
* The header for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<header>
<h1><?php bloginfo( 'name' );?></h1>
<nav id="header-menu">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) );?>
</nav>
</header>
footer.php:
<?php
/**
* The footer for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<footer>
<p>© <?php echo date( 'Y' );?> <?php bloginfo( 'name' );?></p>
</footer>
index.php:
<?php
/**
* The main template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<main>
<?php if ( have_posts() ) :?>
<?php while ( have_posts() ) : the_post();?>
<article>
<h2><?php the_title();?></h2>
<p><?php the_excerpt();?></p>
</article>
<?php endwhile;?>
<?php endif;?>
</main>
single.php:
<?php
/**
* The single post template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<main>
<article>
<h2><?php the_title();?></h2>
<p><?php the_content();?></p>
</article>
</main>
category.php:
<?php
/**
* The category template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<main>
<h2><?php single_cat_title();?></h2>
<ul>
<?php while ( have_posts() ) : the_post();?>
<li>
<h3><a rel="nofollow" target="_blank" href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<p><?php the_excerpt();?></p>
</li>
<?php endwhile;?>
</ul>
</main>
archive.php:
<?php
/**
* The archive template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<main>
<h2><?php the_archive_title();?></h2>
<ul>
<?php while ( have_posts() ) : the_post();?>
<li>
<h3><a rel="nofollow" target="_blank" href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<p><?php the_excerpt();?></p>
</li>
<?php endwhile;?>
</ul>
</main>
search.php:
<?php
/**
* The search results template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<main>
<h2><?php printf( __( 'Search Results for: %s', 'entertainment-news' ), '<span>'. get_search_query(). '</span>' );?></h2>
<ul>
<?php while ( have_posts() ) : the_post();?>
<li>
<h3><a rel="nofollow" target="_blank" href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<p><?php the_excerpt();?></p>
</li>
<?php endwhile;?>
</ul>
</main>
sidebar.php:
<?php
/**
* The sidebar template for our theme
*
* @package Entertainment News
* @subpackage Entertainment News
* @since 1.0.0
*/
?>
<aside>
<h3><?php _e( 'Recent Posts', 'entertainment-news' );?></h3>
<ul>
<?php wp_get_recent_posts( array( 'post_type' => 'post', 'numberposts' => 5 ) );?>
</ul>
</aside>
This codebase provides a basic structure for an entertainment news website, including a responsive design, customizable layout, and a range of widgets to help you showcase your content. You can customize the theme by modifying the styles and scripts, as well as adding or removing widgets and templates as needed.