WordPress News Theme 8

Wordpress News Theme 8In the previous WordPress News Theme Tutorial, I finished the blog part of my theme. In this part I will finish styling: archive.php, page.php, search.php and single.php.

It sounds like a lot of work, but I’m basically copying and pasting all the code from index.php.

If you make sure your styling is done right during the design phase everything else just falls into place.

All of the code follows the video below. For a zipped archive of the entire theme click here.

If you’d like to see a plugin that I haven’t made, now is the time to ask for it in the comment section below.

Code From the Video

ARCHIVE.PHP

<?php get_header(); ?>

 

<?php

$ntt_plugin_folder = get_bloginfo(‘wpurl’);

$ntt_plugin_folder .= ‘/wp-content/plugins/NTTFeaturedContent2/’;

$ntt_plugin_page = $ntt_plugin_folder . ‘js/featured_data1.txt’;

$ntt_plugin_style = $ntt_plugin_folder . ‘ntt_fc_style2.css’;

?>

<LINK href=”<?php echo $ntt_plugin_style;?>” rel=”stylesheet” type=”text/css”>

 

<script type=”text/javascript” src=”<?php echo $ntt_plugin_folder; ?>js/featured_content.js”></script>

<div class=”ntt_featured_content”>

<?php

$ntt_stored_fc = file_get_contents($ntt_plugin_page);

echo $ntt_stored_fc;

?>

</div>

 

<?php get_sidebar(‘first’); ?>

 

<div id=”mainContent”>

 

<?php if (have_posts()) : ?>

 

<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>

 

<?php /* If this is a category archive */ if (is_category()) { ?>

<h2>Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2>

 

<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>

<h2>Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>

 

<?php /* If this is a daily archive */ } elseif (is_day()) { ?>

<h2>Archive for <?php the_time(‘F jS, Y’); ?></h2>

 

<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>

<h2>Archive for <?php the_time(‘F, Y’); ?></h2>

 

<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>

<h2 class=”pagetitle”>Archive for <?php the_time(‘Y’); ?></h2>

 

<?php /* If this is an author archive */ } elseif (is_author()) { ?>

<h2 class=”pagetitle”>Author Archive</h2>

 

<?php /* If this is a paged archive */ } elseif (isset($_GET[‘paged’]) && !empty($_GET[‘paged’])) { ?>

<h2 class=”pagetitle”>Blog Archives</h2>

 

<?php } ?>

 

<?php include (TEMPLATEPATH . ‘/inc/nav.php’ ); ?>

 

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

 

<div id=”postLists”>

 

<div <?php post_class() ?>>

 

<h3 class=”articleTitle”><a href=”<?php the_permalink(); ?>”><?php the_title();?></a></h3><br />

 

 

 

<div class=”entry”>

<p class=”postExcerpt”>

<?php the_content(); ?>

</p>

</div><hr />

 

</div>

 

</div> <!– Ends postLists –>

 

<?php endwhile; ?>

 

</div> <!– Ends mainContent –>

 

<?php include (TEMPLATEPATH . ‘/inc/nav.php’ ); ?>

 

<?php else : ?>

 

<h2>Nothing found</h2>

 

<?php endif; ?>

 

<?php get_footer(); ?>

PAGE.PHP

<?php get_header(); ?>

 

<?php

$ntt_plugin_folder = get_bloginfo(‘wpurl’);

$ntt_plugin_folder .= ‘/wp-content/plugins/NTTFeaturedContent2/’;

$ntt_plugin_page = $ntt_plugin_folder . ‘js/featured_data1.txt’;

$ntt_plugin_style = $ntt_plugin_folder . ‘ntt_fc_style2.css’;

?>

<LINK href=”<?php echo $ntt_plugin_style;?>” rel=”stylesheet” type=”text/css”>

 

<script type=”text/javascript” src=”<?php echo $ntt_plugin_folder; ?>js/featured_content.js”></script>

<div class=”ntt_featured_content”>

<?php

$ntt_stored_fc = file_get_contents($ntt_plugin_page);

echo $ntt_stored_fc;

?>

</div>

 

<?php get_sidebar(‘first’); ?>

 

<div id=”mainContent”>

 

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

 

<div id=”postLists”>

 

<div class=”post” id=”post-<?php the_ID(); ?>”>

 

<h3 class=”articleTitle”><a href=”<?php the_permalink(); ?>”><?php the_title();?></a></h3><br />

 

<?php include (TEMPLATEPATH . ‘/inc/meta.php’ ); ?><br />

 

<div class=”entry”>

 

<p class=”postExcerpt”>

<?php the_content(); ?>

</p>

 

<?php wp_link_pages(array(‘before’ => ‘Pages: ‘, ‘next_or_number’ => ‘number’)); ?>

 

</div>

 

<?php edit_post_link(‘Edit this entry.’, ‘<p>’, ‘</p>’); ?>

 

</div>

 

<?php comments_template(); ?>

 

<?php endwhile; endif; ?>

 

</div>

</div>

 

<?php get_footer(); ?>

SEARCH.PHP

<?php get_header(); ?>

 

<?php

$ntt_plugin_folder = get_bloginfo(‘wpurl’);

$ntt_plugin_folder .= ‘/wp-content/plugins/NTTFeaturedContent2/’;

$ntt_plugin_page = $ntt_plugin_folder . ‘js/featured_data1.txt’;

$ntt_plugin_style = $ntt_plugin_folder . ‘ntt_fc_style2.css’;

?>

<LINK href=”<?php echo $ntt_plugin_style;?>” rel=”stylesheet” type=”text/css”>

 

<script type=”text/javascript” src=”<?php echo $ntt_plugin_folder; ?>js/featured_content.js”></script>

<div class=”ntt_featured_content”>

<?php

$ntt_stored_fc = file_get_contents($ntt_plugin_page);

echo $ntt_stored_fc;

?>

</div>

 

<?php get_sidebar(‘first’); ?>

 

<div id=”mainContent”>

 

<?php if (have_posts()) : ?>

 

<h2>Search Results</h2>

 

<?php include (TEMPLATEPATH . ‘/inc/nav.php’ ); ?>

 

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

 

<div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>

 

<div id=”postLists”>

 

<h3 class=”articleTitle”><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></h3>

 

<?php include (TEMPLATEPATH . ‘/inc/meta.php’ ); ?><br />

 

<div class=”entry”>

 

<p class=”postExcerpt”>

<?php the_content(); ?>

</p>

 

</div>

<hr />

 

</div>

 

</div> <!– Ends postLists –>

 

<?php endwhile; ?>

 

</div> <!– Ends mainContent –>

 

<?php include (TEMPLATEPATH . ‘/inc/nav.php’ ); ?>

 

<?php else : ?>

 

<h2>No posts found.</h2>

 

<?php endif; ?>

 

<?php get_footer(); ?>

 

SINGLE.PHP

<?php get_header(); ?>

 

<?php

$ntt_plugin_folder = get_bloginfo(‘wpurl’);

$ntt_plugin_folder .= ‘/wp-content/plugins/NTTFeaturedContent2/’;

$ntt_plugin_page = $ntt_plugin_folder . ‘js/featured_data1.txt’;

$ntt_plugin_style = $ntt_plugin_folder . ‘ntt_fc_style2.css’;

?>

<LINK href=”<?php echo $ntt_plugin_style;?>” rel=”stylesheet” type=”text/css”>

 

<script type=”text/javascript” src=”<?php echo $ntt_plugin_folder; ?>js/featured_content.js”></script>

<div class=”ntt_featured_content”>

<?php

$ntt_stored_fc = file_get_contents($ntt_plugin_page);

echo $ntt_stored_fc;

?>

</div>

 

<?php get_sidebar(‘first’); ?>

 

<div id=”mainContent”>

 

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

 

<div class=”articleContent”>

 

<div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>

 

<h3 class=”articleTitle”><a href=”<?php the_permalink(); ?>”><?php the_title();?></a></h3><br />

 

<div class=”entry”>

 

<p class=”postExcerpt”>

<?php the_content(); ?>

</p>

 

<?php wp_link_pages(array(‘before’ => ‘Pages: ‘, ‘next_or_number’ => ‘number’)); ?>

 

<?php the_tags( ‘Tags: ‘, ‘, ‘, ”); ?>

 

</div>

 

<?php include (TEMPLATEPATH . ‘/inc/meta.php’ ); ?>

 

<?php edit_post_link(‘Edit this entry’,”,’.’); ?>

 

</div>

 

<?php comments_template(); ?>

 

</div>

 

<?php endwhile; endif; ?>

 

</div>

 

<?php get_footer(); ?>

 

19 Responses to “WordPress News Theme 8”

  1. jkkdism says:

    Hi Derek, this is a great tutorials, thank you. Just quick question: Where can I download the finished ZIP version of “wordPress news Theme” that you have created in the tutorial. Thanks.

    • admin says:

      Thanks for bring that up. I thought I put up a zipped archive but I guess not. I’ll put it in part 1 of the tutorial as soon as possible. If you don’t want to wait you can copy and paste the code from the tutorial

  2. jkk says:

    Thanks Derek for your time and I really appreciate your help. Thanks.

  3. David F says:

    Derek, this is amazing! I’ve spent the last 2 weeks listening through most of your wordpress and jQuery tutorials and you’ve completely de-mystified the whole topic for me. incredible! i knew a bit of css and html from before, but thought i’d need to spend a year or so with php and javascript before i’d have any chance to do anything to a wp blog… turns out not 😉 Big thanks!!!

    anyway here comes my suggestions/requests if you’re still find time to churn these tutes out; i’d love to know how to create a Newsletter Submission box and another thing I’ve tried researching is creating a client login with individual access to specific client-pages.
    Not sure how advanced these things might be, but would sure be interested to hear how you’d tackle those topics.
    I’ve got other jQuery based animation questions too, but i’ll try to curb my excitement for time being 🙂 thanks again!
    cheers .david

  4. David F says:

    Thanks, I checked that one out too. awesome stuff.. super helpful as always!
    pardon my greed but would you have a similar video around covering client-login and client-pages?
    I’ve looked around how to do that and it seems that people have tried to solve it with other combinations of plugins, but there seems to be various problems that occur when trying to make sure that a logged in client only gains access to one specific page, and not all password protected pages. personally i’m only looking for a solution where i provide the client accounts manually, not having clients create their own accounts..
    sorry, i realise i’m asking a lot… and maybe wp isn’t even geared towards a solution like that at all.
    although i’m currently blinded by the possibilities so I thought i’d ask anyway 🙂
    cheers .david

    • admin says:

      I did that for a client awhile back. I’ll look and see if I can find the code. Basically I had WordPress:
      1. Assign a personal page for each user
      2. When someone went on one of those pages I checked if they where logged in and the right person
      3. I then created session keys and tokens to verify identities

      It sounds hard, but I pretty much cover everything in Secure Login Script

  5. Menno says:

    Hi Derek,

    I have a Question.
    For a new theme i have just made, i use the SI CAPTCHA plugin to use for my comment but when somebody will place a comment the plugin doesn’t work.

    Can you tell me what the problem is and how to fix this.

  6. mark says:

    how do i add the comment reply link to my theme

  7. Rizwan says:

    Hello sir,
    My wordpress post not display the HTML CODE.

    I am write the code of href

    in wordpress HTML Post area but it display as plane text

    and not show as link.

    I am update the wordpress but this issue is not solved.

    Please replay me.

    • admin says:

      It is kind of hard for me to do anything because their is so much code. If you use the code from the tutorial I’m sure it will work. If you have an error, you’ll find it where you changed my code. I hope that helps

  8. Thanks Derek,

    You’re a true gem and your work is inspiring. Please shoot me a short email, I hope I can interest you in a project that I’m working on.

    Best,

    William Adofo

Leave a Reply

Your email address will not be published.

Google+