Wordpress Theme

Posted by HotPizzaBox on Pro Webmasters See other posts from Pro Webmasters or by HotPizzaBox
Published on 2012-10-23T08:52:30Z Indexed on 2012/10/23 11:20 UTC
Read the original article Hit count: 249

Filed under:

I'm trying to create a basic wordpress theme. As far as I know the basic files I need are the style.css, header.php, index.php, footer.php, functions.php. Then it should show a blank site with some meta tags in the header.

These are my files:

functions.php

<?php
// load the language files
load_theme_textdomain('brianroyfoundation', get_template_directory() . '/languages');

// add menu support
add_theme_support('menus');

register_nav_menus(array('primary_navigation' => __('Primary Navigation', 'BrianRoyFoundation')));

// create widget areas: sidebar
$sidebars = array('Sidebar');

foreach ($sidebars as $sidebar)
{
    register_sidebar(array('name'=> $sidebar,
        'before_widget' => '<div class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h6><strong>',
        'after_title' => '</strong></h6>'
    ));
}

// Add Foundation 'active' class for the current menu item 
function active_nav_class($classes, $item)
{
    if($item->current == 1)
    {
        $classes[] = 'active';
    }
    return $classes;
}

add_filter( 'nav_menu_css_class', 'active_nav_class', 10, 2);
?>

header.php

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo('charset'); ?>" />

    <meta name="description" content="<?php bloginfo('description'); ?>">

    <meta name="google-site-verification" content="">

    <meta name="author" content="Your Name Here">

    <!-- No indexing if Search page is displayed -->
    <?php if(is_search()){ echo '<meta name="robots" content="noindex, nofollow" />' } ?>

    <title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />

    <?php wp_head(); ?>
</head>
<body>
    <div id="page">
        <div id="page-header">
            <div id="page-title">
                <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>
            </div>
            <div id="page-navigation">
                <?php
                    wp_nav_menu( array(
                    'theme_location' => 'primary_navigation',
                    'container' =>false,
                    'menu_class' => ''
                ); ?>
            </div>
        </div>
        <div id="page-content">

index.php

<?php get_header(); ?>

            <div class="page-blog">
                <?php get_template_part('loop', 'index'); ?>
            </div>
            <div class="page-sidebar">
                <?php get_sidebar(); ?>
            </div>

 <?php get_footer(); ?>

footer.php

            </div>
        <div id="page-footer">
            &copy; 2008 - <?php echo date('Y'); ?> All rights reserved.
        </div>
    </div>

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

I activated the theme in wordpress. But it just shows nothing. Not even if I view the page source. Can anyone help?

© Pro Webmasters or respective owner

Related posts about Wordpress