WordPress.org

Ready to get started?Download WordPress

Forums

Need help with the_excerpt() (2 posts)

  1. floda_reltih
    Member
    Posted 9 years ago #

    Salut.
    I need some help with the the_excerpt(). In my index.php (theme) I have this

    <div id="content">

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

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

    <?php $custom_fields = get_post_custom(); //custom fields ?>

    <?php if (isset($custom_fields["BX_post_type"]) && $custom_fields["BX_post_type"][0] == "mini") { ?>

    <hr class="low" />

    <div class="minientry">

    <?php echo BX_remove_p($post->post_content); ?>
    <?php comments_popup_link('(0)', '(1)', '(%)', 'commentlink', ''); ?>
    " class="permalink" title="Permalink"><?php the_time('M j, \'y') ?><!--, <?php the_time('h:ia') ?>-->
    <!--<em class="author"><?php the_author() ?>-->
    <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>

    </div>

    <hr class="low" />

    <?php } else { ?>

    <div class="entry">

    <h2>" title="Permalink"><?php the_title(); ?></h2>

    <?php ($post->post_excerpt != "")? the_excerpt() : the_content(); ?>

    <p class="info"><?php if ($post->post_excerpt != "") { ?>" class="more">Continue Reading<?php } ?>
    <?php comments_popup_link('Add comment', '1 comment', '% comments', 'commentlink', ''); ?>
    <em class="date"><?php the_time('F jS, Y') ?><!-- at <?php the_time('h:ia') ?>-->
    <!--<em class="author"><?php the_author(); ?>-->
    <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>

    But when I use the <!-- more --> thing in my post it still displays the default (more...) on the front page, that is in template-functions-post.php (how can I change it, without messing with template-functions-post.php itself?

    Besides, if I change :
    <?php ($post->post_excerpt != "")? the_excerpt() : the_content(); ?>

    to

    <?php ($post->post_excerpt != "")? the_excerpt() : the_excerpt(); ?>

    it uses the [...] after the first 120 words, which is OK, but I would like to replace it with my own text and put a link there I guess that - <p class="info"><?php if ($post->post_excerpt != "") { ?>" class="more">Continue Reading<?php } ?> is suppose to do that (thx to the Blix theme Im using) but Im not sure how I can activate that?

    Moreover, and even more importantly, I would like to shorten post in a similar way in the categories and subcategories, when you click on a particular one, same with the archives. What file I need to edit, in regards to the Blix theme.

    Huge thx in advance.

  2. floda_reltih
    Member
    Posted 9 years ago #

    Got my hands on this post http://wordpress.org/support/topic/24679/rss/
    now this part
    <h2>" title="Permalink"><?php the_title(); ?></h2>

    <?php ($post->post_excerpt != "")? the_excerpt() : the_content(); ?>

    <p class="info"><?php if ($post->post_excerpt != "") { ?>" class="more">Continue Reading<?php } ?>

    works fine, but I have one problem - when I click on the Continue Reading link it gives me the full text, EXCLUDING the excerpt part! But i want it to display the whole post. Is it possible to fix?

    BTW my wd.php still says <?php the_content(); ?>
    do I have to change it to something like <?php if(is_single()) { ?>
    <?php the_content(); ?>
    <?php } else { ?>
    <?php the_excerpt(); ?>
    <?php } ?>

    ??

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.