WordPress.org

Ready to get started?Download WordPress

Forums

more-tag not working on custom page (4 posts)

  1. Sigel@Panama
    Member
    Posted 8 months ago #

    Hi there!

    I guess this is an old topic but i just can´t find a solution for this problem.
    I want to force the more tag to work on a custom page and already found this workaround: global $more; $more = 0;
    It shows the more link but nothing happens when i click on it?
    The URL changes: "#more-11" is being added.

    This is all the code i´m using for this custom site:

    <div id="content">
    	<?php if ( have_posts() )  while ( have_posts() ) : the_post();?>
    	<!-- <?php global $more; $more = FALSE; ?> -->
    	<?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {the_post_thumbnail();} ?>
    	<div id="content-text">
    		<?php force_more(); the_content(__('mehr lesen'));?>
    	</div>
    	<?php $more = TRUE; ?>
    	<?php endwhile; ?>
    </div><!-- end of #content -->
    
    <?php function force_more() {
    	global $more;
    	$more = 0;
    }?>

    Am i missing something? Sorry if my english is a bit weird :P

  2. vtxyzzy
    Member
    Posted 8 months ago #

    I think you need to declare the global and set the value in the code where you call the_content(), not inside a function.

  3. Sigel@Panama
    Member
    Posted 8 months ago #

    Thx for the reply vtxyzzy !

    I tried it that way as well:

    <div id="content">
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php
    		global $more;
    		$more = 0;
    	?>
    
    	<?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {the_post_thumbnail();} ?>
    	<div id="content-text">
    		<?php the_content('mehr lesen'); ?>
    	</div>
    
    	<?php $more = TRUE; ?>
    	<?php endwhile; ?>
    </div><!-- end of #content -->

    but it doesn´t work either.

    Maybe i´m doing something wrong in the RTE? I´m using the more-tag this way:
    Text
    <!--more-->
    Text

  4. alchymyth
    The Sweeper & Moderator
    Posted 8 months ago #

    on custom page

    is that page using a page template?

    It shows the more link but nothing happens when i click on it?

    if the link uses the same template, then nothing can happen.

    this method only works if you want to show a page excerpt on one page which then links to a different page for the full page content.

    can you post a link to the custom page to illustrate the output of the more-link etc?

Reply

You must log in to post.

About this Topic