go41

Re: display first Post full and following posts as Excerpts :: Reply by master

von Joern am 22. Apr. 2010 | Keine Kommentare

thanks for asking, I try to make it easy.

In your theme folder you have to edit index.php -> MAKE A BACKUP OF THIS FILE FIRST!!

Okay, we are going to modify the loop in the section below the category bar (in arthemia called ‚front-list‘)

I give you first all the pieces you have to add in and at the end the full index.php to see where this pieces are.
1. add (line 77) to set a counter

<?php $count = 1; // THIS IS NEW sets count to 1 ?>
2. add following to display the_content if it’s the first post in this ‚loop‘ and if it’s not paged

<?php if ((!is_paged()) && ($count == 1)){ // THIS STARTS FULL CONTENT IF IS FIRST POST AN NOT PAGED ?>
<?php the_content(); ?>
<?php } else { // THIS ends FULL CONTENT and SHOWS FOLLOWING POSTS ELSE ?>
3. add some lines later the following to end the display of all next posts as normally and to set the counter up one value on each run

<?php } $count++; // THIS IS the END of ELSE and sets count one up ?>
Now here is the full modified index.php of arthemia to show where the pieces have to be
<?php get_header(); ?>

<?php if(!is_paged()) { ?>

<div id="top" class="clearfloat">

<div id="headline">
<img src="<?php echo get_option(‚home‘); ?>/wp-content/themes/arthemia/images/headline.png" width="75px" height="21px" alt="" />
<?php query_posts("showposts=1&category_name=Headline"); ?>
<?php while (have_posts()) : the_post(); ?>

<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
<div class="meta">[<?php the_time(‚j M Y‘) ?> | <?php comments_popup_link(‚No Comment‘, ‚One Comment‘, ‚% Comments‘);?> | <?php if(function_exists(‚the_views‘)) { the_views(); } ?>]</div>
<?php $values = get_post_custom_values("Headline");?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php echo bloginfo(‚template_url‘); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=300&h=275&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="300px" height="275px" /></a>
<?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the full story &raquo;</a>
<?php endwhile; ?>
</div>

<div id="featured">

<img src="<?php echo get_option(‚home‘); ?>/wp-content/themes/arthemia/images/featured.png" width="72px" height="17px" alt="" />

<?php query_posts("showposts=4&category_name=Featured"); $i = 1; ?>

<?php while (have_posts()) : the_post(); ?>
<div class="clearfloat">
<?php $values = get_post_custom_values("Image");
if (isset($values[0])) { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php echo bloginfo(‚template_url‘); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=100&h=65&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="100px" height="65px" /></a>
<?php } ?>
<div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php the_title(); ?></a>
<div class="meta">[<?php the_time(‚j M Y‘) ?> | <?php comments_popup_link(‚No Comment‘, ‚One Comment‘, ‚% Comments‘);?> | <?php if(function_exists(‚the_views‘)) { the_views(); } ?>]</div>

</div>
</div>

<?php endwhile; ?>

</div>

</div>

<div id="middle" class="clearfloat">
<img src="<?php echo get_option(‚home‘); ?>/wp-content/themes/arthemia/images/category.png" class="clearfloat" alt="" />
<?php $display_categories = array(5,6,7,8,11); $i = 1;
foreach ($display_categories as $category) { ?>

<div id="cat-<?php echo $i; ?>" class="category">
<?php query_posts("showposts=1&cat=$category")?>
<span class="cat_title"><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span>
<a href="<?php echo get_category_link($category);?>"><?php echo category_description($category); ?></a>
</div>

<?php $i++; ?>
<?php } ?>

</div>

<?php } ?>

<div id="bottom" class="clearfloat">

<div id="front-list">

<?php
$page = (get_query_var(‚paged‘)) ? get_query_var(‚paged‘) : 1;
query_posts("cat=-27,-28&paged=$page&posts_per_page=5"); ?>
<?php $count = 1; // THIS IS NEW sets count to 1 ?>
<?php while (have_posts()) : the_post(); ?>

<div class="clearfloat">
<h3 class=cat_title><?php the_category(‚, ‚); ?> &raquo</h3>
<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
<div class="meta">[<?php the_time(‚j M Y‘) ?> | <?php comments_popup_link(‚No Comment‘, ‚One Comment‘, ‚% Comments‘);?> | <?php if(function_exists(‚the_views‘)) { the_views(); } ?>]</div>

<div class="spoiler">

<?php if ((!is_paged()) && ($count == 1)){ // THIS STARTS FULL CONTENT IF IS FIRST POST AN NOT PAGED ?>
<?php the_content(); ?>
<?php } else { // THIS ends FULL CONTENT and SHOWS FOLLOWING POSTS ELSE ?>

<?php $values = get_post_custom_values("Image");
if (isset($values[0])) { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php echo bloginfo(‚template_url‘); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=150&h=150&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="150px" height="150px" /></a>
<?php } ?>

<?php the_excerpt(); ?>

<?php } $count++; // THIS IS the END of ELSE and sets count one up ?>

</div>

</div>
<?php endwhile; ?>

<div class="navigation">
<?php if(function_exists(‚wp_pagenavi‘)) { wp_pagenavi(); }
else { ?>

<div class="right"><?php next_posts_link(‚Next Page &raquo;‘) ?></div>
<div class="left"><?php previous_posts_link(‚&laquo; Previous Page‘) ?></div>
<?php } ?>

</div>

</div>

<?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>
You could take this full index.php but have to change the category IDs as you did before in category bar and frontlist
Did you make it?
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 9 weitere Ergebnisse dieses Threads:

display first Post full and following posts as Excerpts

22. Apr. 2010 (von: sereque)

I like show the first post as full and the following as excerpts. is it possible? I am referring to the section below the block of categories that is displayed as excerpt for default . I try the plugin homepage…

Re: display first Post full and following posts as Excerpts :: Reply by sereque

23. Apr. 2010 (von: sereque)

Hi Joern, the code work smoothly on the first try. I'm in the process of setting up a personal blog about birding and nature focused on the region where I live in Yucatan, Mexico. For now I am working offline…

Blocking and protect access to wp-login.php – WordPress Brute Force Attacks

9. Jun. 2013 (von: Joern)

On checking AWSTATS of my sites I find more and more login attempts, AWSTATS shows:url Viewed Average size Entry Exit/wp-login.php 5595 3.71 KB 1896 1897/ 109 25.78 KB 82 57the access log of this site shows me entries of many…

Display rss feed titles reverse – thread title • forum name

9. Jun. 2013 (von: f-t-cat)

I didn't like the display of the phpBB feed titles like *Forum Name* • *Post Name*What I prefer is first the post name and behind the forum name like change the title tag in phpBB • phpBB MODsto get this…

Admin, need help with WordPress and failure of Google to crawl my site

12. Jul. 2013 (von: omerkhan01)

Hi there, Here is my issue. When I type my [url="http://www.maaximumseduction.com"]domain name[/url] with the www, Google displays site links under my home page's url in the Search Engine Results Page. However when I type my domain name without the www,…

Re: Admin, need help with WordPress and failure of Google to crawl my site :: Reply by Joern

12. Jul. 2013 (von: Joern)

Hi Omar, glad you managed to login into my forum on phpbb.your site is working with www only, the 301 redirect on the server side has no effect.you can try this by typing in the browser http://maaximumseduction.com without www, this…

Re: Admin, need help with WordPress and failure of Google to crawl my site :: Reply by omerkhan01

13. Jul. 2013 (von: omerkhan01)

Okay but here is my question, in fact 2 of them.1. Why is google not displaying site links under my home page url in the Search Engine results when you type my domain name without the www?2. What can I…

Re: Admin, need help with WordPress and failure of Google to crawl my site :: Reply by Joern

13. Jul. 2013 (von: Joern)

Google considers with www and non-www URL as two sites (i think..)Your site has and shows internally only links under the www-version, non-www is correctly rewritten to www.Answer1. So there can't be any link under non-www.Your pages are indexed, this…

Re: Display rss feed titles reverse – thread title • forum name :: Reply by master

7. Mrz. 2015 (von: master)

this mod doesn't work in phpBB 3.1.x anymorefeed.php is much shorter and you have to edit other source files to display the feed titles reverse.Anyone knows an extension for current phpBB 3.1.3 to change feed topic titles??____________________you find ... Weiterlesen…

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: