WordPress.org

Ready to get started?Download WordPress

Forums

Turning off "truncate_post"... (5 posts)

  1. japhoto
    Member
    Posted 1 year ago #

    Hey,

    I'm fairly new to WordPress, so help with this issue is much appreciated.

    I'm using a theme which has a separate "blog template". I'm using WordPress as a CMS, so I'm trying to base a whole website on it.

    The problem I have is that I can't use the "More" tag the way I'd like to since the blog template is truncating my post to have 600 characters.

    <div class="blog-content-holder">
                        <div class="blog-post-text"><?php truncate_post(600); ?></div>
                        <a class="blog-cell_read_more" href="<?php the_permalink(); ?>">More</a>
                    </div>

    This code is in "_blog.php" - file and I can change the amount of characters here. I'd like to get rid of the blog automatically assigning the "More" tag after the truncation. I usually post photos, so I might not even have 600 characters in my posts.

    So what it comes down to is that I'd like to assign the placement of the "More" - tag myself.

    Thank you in advance.

    Janne

  2. Try replacing <?php truncate_post(600); ?> with <?php the_content('Read more...'); ?>

  3. japhoto
    Member
    Posted 1 year ago #

    Thank you Christine for the advice. I changed that line, but it didn't solve the issue quite yet.

    Now it shows the whole post and ignores the "more"-tags completely, but generates a "more"-link on the bottom of each post.

    I'll try to resolve this issue on this end, but if someone knows an answer to this it would be appreciated greatly.

    Janne

  4. If you're site is online, maybe post a link to it, so we can see.. Perhaps something knows more about the theme you are using.

  5. japhoto
    Member
    Posted 1 year ago #

    Hey Christine,

    The site is not online quite yet, but I did manage to find a way around this problem.

    I suspect that there's something higher up that negates the use of "the_content", but what I did was to replace "truncate_post" with "the_excerpt" and then install a plugin called Advanced excerpt. That combination seems to work fine for me.

    I left the lower line of code alone so that the theme will still generate the "Read more" link in its own style and at the Advanced excerpt options I chose not to generate "Read more" links. I also set the Excerpt length at only one word, but checked the "Finish: sentence" so that I get one sentence excerpt no matter how short or long it might be.

    Even though this isn't the solution I was originally looking for, I'll mark this topic as resolved.

    For the record, the theme I'm using is "Widely" from Themes Kingdom, a free one too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags