WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Read More link leads nowhere on page (19 posts)

  1. Rhand
    Member
    Posted 4 years ago #

    I added the necessary code on a page to show the read more tag as mentioned here: http://codex.wordpress.org/Customizing_the_Read_More :

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

    But somehow it leads nowhere as it prints this html

    http://www.domain.com/folder/#more-16

    This guy mentioned the same issue, but without an answer: http://www.rlmseo.com/blog/read-more-link-on-wordpress-pages/comment-page-1/#comment-233

  2. Rhand
    Member
    Posted 4 years ago #

    Hmm, the read more tag <!--more--> does not show on a post either while I do use

    <?php the_content('<p class="serif">Read the rest of this article &raquo;</p>'); ?>
  3. Rhand
    Member
    Posted 4 years ago #

    Found out I need a custom query as well @ http://weblogtoolscollection.com/archives/2007/07/09/the-more-tag-on-a-wordpress-page/ to get the more link to display the rest and adjusted the more data a bit was well:

    <?php
    global $more;
    $more = FALSE;
    ?>
    <?php the_content("Lees de rest van deze pagina &raquo;"); ?>
    <?php $more = true; ?>
  4. Rhand
    Member
    Posted 4 years ago #

    There is a thread about it here: http://wordpress.org/support/topic/113544?replies=18 , but it shows the same data without a need wp_query.

    NB Read More link does work as it should on the index now. Just not on page.php with the earlier mentioned added code

  5. Rhand
    Member
    Posted 4 years ago #

    Hmm, not solved yet. Reading http://wordpress.org/support/topic/168032?replies=20 and using this code for now:

    <?php get_header(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    <?php global $more;$more = 0;?>
    <?php the_content("Lees de rest van deze pagina »"); ?>

    Still get a link that leads to nowhere: http://www.domain.com/portfolio/#more-16

  6. Rhand
    Member
    Posted 4 years ago #

    Anyone?

  7. Rhand
    Member
    Posted 4 years ago #

    Bump

  8. Rhand
    Member
    Posted 4 years ago #

    Well $more and $more_link_text are mentioned in post-template.php , deprecated.php, classes.php, comment-template.php, and feed-feedtype.php. I start to think I might need $more_link_text only or that I least need to add it to my code. But the $more_link_text should be part of my code already as I use the_content function (see http://codex.wordpress.org/Function_Reference/the_content).

  9. Rhand
    Member
    Posted 4 years ago #

    Read http://wordpress.org/support/topic/328514?replies=10 and am trying some other code options.

  10. Rhand
    Member
    Posted 4 years ago #

    No luck yet either with making $more global just after the header and declaring $more 1 just before the_content()

  11. Rhand
    Member
    Posted 4 years ago #

  12. Rhand
    Member
    Posted 4 years ago #

    I'd say this can only be achieved with a query_posts() or maybe a WP_Query. Query_posts can be easily used on the index or home page, but I am still wondering how I could use query_posts just to display the read more tag on pages. Maybe I should just go for an excerpt. I read somewhere there is a plugin for it.
    Pages in WordPress seem to be really limited. I should have gone for a category, or maybe I should consider a template for the page where I want the read more tag to show.

  13. Rhand
    Member
    Posted 4 years ago #

    Well, made a template with query_posts, but still no functioning read more that links to the full page:

    <?php
    /*
    Template Name: Portfolio page
    */
    ?>
    <?php get_header(); ?>
    
    <div id="content" class="narrowcolumn">
    <?php
    //The Query
    query_posts('pagename=portfolio');
    global $more;
    ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $more = 0;?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    
    <?php the_content('Lees de rest van deze pagina »'); ?>
    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    </div>
    </div>
    <?php endwhile; ?>

    Link still returns the same data (page text until read more. Link is: http://www.domain.com/portfolio/#more-16

  14. Rhand
    Member
    Posted 4 years ago #

    Will work on code here: http://wordpress.pastebin.com/f2xeiD4A

  15. Rhand
    Member
    Posted 4 years ago #

    Trying query_posts preservation: http://wordpress.pastebin.com/dJDtwAXT . No luck yet either. Must still be missing something..

  16. Mike Schinkel
    Member
    Posted 4 years ago #

    Reading through this entire thing I understand that it's not working the way you want it to work, but I still don't understand what exactly it is you want to happen. Can you please describe exactly what you want to happen in addition to your explaination of how it is working incorrectly?

  17. Rhand
    Member
    Posted 4 years ago #

    @ Mike Schinkel I want to be able to use the WordPress <--more--> on pages using the wysiwyg editor. I have managed to make the read more tag show on a page with the code indicated above. Only now the read more link does NOT work. I goes back to the same page, but keeps on hiding the rest of the text which makes the read more tag a useless. I am considering using the_excerpt() function now as I seem not to be able to solve this.

  18. Rhand
    Member
    Posted 4 years ago #

    I tried the excerpt function on the page to show a link to the rest of the content on the page using the_excerpt() function <?php the_excerpt(); ?> on the page and a filter in the functions.php:

    function new_excerpt_more($more) {
    return ' 	<a href="'. get_permalink($post->ID) . '">' . 'Lees de rest van deze pagina...' . '</a>';
    
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    It created a link going to the exact same page, but did not reveal the rest of the page's content.

  19. Rhand
    Member
    Posted 4 years ago #

    Well solved it by creating links in the tinymce editor. Links that go to child pages that are hidden from the menu. Not the greatest solution, but it works

Topic Closed

This topic has been closed to new replies.

About this Topic