WordPress.org

Ready to get started?Download WordPress

Forums

More tag not working (15 posts)

  1. iselltheta
    Member
    Posted 3 years ago #

    I am using a custom WP template and cannot get the more tag to work. I insert the tag while writing a post (and see it inserted) but the tag does not appear on the actual post but rather the full post (if less than 55 words) or with [...] at the end which is not hyperlinked (for posts greater than 55 words). The only way I can view the full post is to click on the post title. I added the following code ahead of the call for content in the page.php file but still no luck:

    <?php global $more; $more = 0; ?>

    (have tried changing the 0 to a 1 and to a true and a false). I've googled this problem for hours and the only fix I see is the above snippet of code but it appears it does not work for everyone, me included. Please help.....

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    or with [...] at the end which is not hyperlinked

    this points to the fact that the template is using 'the_excerpt();' and not 'the_content();'

    you could paste the code of your template into a http://wordpress.pastebin.com/ and post the link to it here;
    a link to your site might also help to illustrate your problem.

  3. iselltheta
    Member
    Posted 3 years ago #

    The page.php file is here (pretty small file). It includes the code I added as mentioned in the first post (tried 0, 1, TRUE, FALSE).

    [code moderated as per forum rules - please use the pastebin]

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    page.php is an unlikely template to be used to show the post(s); it is normally used to show static pages.

    to identify the used template, see http://codex.wordpress.org/Template_Hierarchy

    it could be index.php (?)

  5. iselltheta
    Member
    Posted 3 years ago #

    I edited the page.php file and you are correct it did work for my posts that are directly on a page. I see now on my posts that my index.php file is using excerpts. I changed to the_content and it works but my formatting on the page is off. The following code is now in the index.php file

    <div class="post-excerpt">
    <?php the_excerpt(); ?>

    I changed the line

    <?php the_excerpt(); ?> to

    <?php the_content( $more_link_text, $strip_teaser, $more_file ); ?>

    but am unsure what to do with the line that reads <div class="post-excerpt">

    If I can figure that out, my problem should be solved. Thanks in advance for any further help.

  6. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    but am unsure what to do with the line that reads <div class="post-excerpt">

    best leave it where it is;
    changing the html structure can very easily break the design of a page. if you would remove it, you would also need to find the corresponding </div> or you would invalidate the html code of your site.

    I changed to the_content and it works but my formatting on the page is off.

    to only way to support you there is by checking the live site, for which a link to your site is needed.

  7. iselltheta
    Member
    Posted 3 years ago #

    Thanks for the help. My site is macrostory.com - right now it has the excerpt function in. Please let me know if you need me to do something else to troubleshoot. Thank you for your help so far. You almost have my solution....

  8. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    I changed to the_content and it works but my formatting on the page is off.

    to get any help with this issue, you need to have 'the_content()' in your code in the live site, because otherwise nobody will be able to see how the formatting is off.

    however, it a is a good reference point to have seen the site as it should be.

  9. iselltheta
    Member
    Posted 3 years ago #

    Makes sense... I added the content code in. The sidebar is now populating with posts that are meant for the body. Thank you for all the help so far....

  10. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    you have some weird test content in your posts, particular in post id 88 'wednesday' from 21st, and post id 94 'friday'

    this seems to have unbalanced divs and is simply breaking the design.

    http://validator.w3.org/check?uri=http%3A%2F%2Fmacrostory.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

    generate proper test content, and check your site again.

  11. iselltheta
    Member
    Posted 3 years ago #

    You are a god... Thank you! That took care of it. I do have one final problem perhaps you can save me an hour of digging for the fix. I don't actually have the word "more" appear where the link is to expand the text. The code currently reads

    <?php the_content('read more'); ?>

    I am using a sliding read more plugin but when I deactivate it the text still won't appear. Any idea why my text is not appearing? I tried adding the following code as well but still no words appear

    <?php
    global $more;
    $more = 0;
    ?>

    Any idea? Thank you so much again for all you have done. I spent about 5 hours googling and trying various things to fix this problem before I opened this thread.

  12. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    the 'Read More' link is there, however colored white on white and therefore invisible.

    adding this to style.css makes it visible:
    a.toggleLink { color: #777; }

    seems to be working with some javascript/jQuery plugin that is meant to expand the text on the front page by clicking on the link.

    it is not linking to the single post.

    if you want to ahve it link to the single post, check which plugin you have activated for this kind of purpose; then deactivate it and see if this changes the 'read more' links.

  13. iselltheta
    Member
    Posted 3 years ago #

    I really hate to ask such a naive question but after trying to add the above line to the style sheet I must admit, I don't know where to add it in the file.

    I do have a plugin that expands the text when you click "read more." I did a little test and it seems to be expanding the proper post.

  14. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    you can add the new style anywhere to style.css, just make sure not to break existing styles.

    for instance, add it at the end after the last line, so the new end looks like:

    .fbg .left { width:220px; margin:0 10px 20px 10px; padding:0; float:left; }
    a.toggleLink { color: #777; }

    #777 is the color code for grey, you can use a differetn color if you like.

  15. iselltheta
    Member
    Posted 3 years ago #

    I actually changed the class from excerpt to content and it seems to work now.

    <div class="content">

    <?php the_content('read more'); ?>

    Thank you a TON for all of your help. I'd buy you a beer if you lived near me. Thank You!

Topic Closed

This topic has been closed to new replies.

About this Topic