• Sponsors


  • Change Teen Style into News theme





    In this post, i will try to show you, how to change Teen Style that arrange the post according to category that we selected in option page, into a newspaper theme that no need to setup the category. All post will be shown at the main page, all of them were sorted by the latest post.

    Let we see this sample of code. This code were inside the “index.php” file. This file is the one that responsible to show the main page layout.

    <div class=”maincenter”>
    <?php $recent = new WP_Query(“cat=-<? echo $ts_fea1_id; ?>,-<? echo $ts_pho; ?>,-<? echo $ts_fea2_id; ?>&showposts=1&offset=0“); while($recent->have_posts()) : $recent->the_post();?>
    <div class=”featuredcenter”>
    <a href=”<?php the_permalink() ?>” title=”<?php the_title(); ?>”><?php if ( function_exists(“has_post_thumbnail”) && has_post_thumbnail() ) { the_post_thumbnail(array(100,100), array(“class” => “thumbs”)); } ?></a>

    <h3><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h3>
    <?php excerpt(’38′); ?>
    </div>
    <?php endwhile; ?>

    The red colored code is responsible to select featured category to show in this main page (for this area only). It controlling the category name, how many post that will show, and number of post that will be skipped.

    To make this area posting in a row (without selected category), just delete that red script, and change it with something like this :

    <?php $recent = new WP_Query(“cat=showposts=1&offset=0“); while($recent->have_posts()) : $recent->the_post();?>

    So, we only need to deleting this code : -<? echo $ts_fea1_id; ?>,-<? echo $ts_pho; ?>,-<? echo $ts_fea2_id; ?>&

    That script will show 1 post, and that post is the first post (latest post). For the script below this area, it will looks like this : &showposts=1&offset=1. It will mean that in this area, it will show only one post, and that post is post number two from latest post). If you change the offset number into 10, it will mean that script will skip 10th first post, so the first post that will shown is the 11th post.

    The green colored code is responsible to show the thumbnail. Inside that script we can know that the size of the thumbnail width is 100px and height in 100 px. For the image class, this area using “thumbs”. Deleting this script, and chang it with get the image plugin script. You can use script something like this :

    <?php get_the_image(‘width=100&height=100&image_class=thumbs’); ?>

    Every area in this theme has its own size, so please use this script with the proper image size. Another file that should be modified is sidebar_left.php, sidebar_right.php, archive.php

    Result (demo) : Divirama : Best Dictionary Shop

    Have no time to make modification? or maybe you get no luck with this theme? Get this Teen Style Theme instantly here : Download Teen Style

    Author: cahyo on December 13, 2010
    Category: themes
    Tags: , , , , , , , , , , , , , ,

    Facebook comments:

    3 responses to “Change Teen Style into News theme”
    1. [...] View full post on AutoBlog Theme [...]

    Leave a Reply


    7 + = 15

    Last articles