• hello ,

    i have to add The “More” Tag on a WordPress Page. The solution i got is as follows through forums :-

    The technique is rather simple. Simply declare a variable named $more as a global and set it to false right before showing your content. If you wish to resume normal behavior after the content is shown, simply set the variable back to true.

    <?php global $more; $more = false; ?>
    <?php the_content(‘Continue Reading’); ?>
    <?php $more = true; ?>

    Can anyone explain me the above solution , like where we have to add this code . please step be step how to add the tag on the wordpress pages . I am trying to make a website which is not yet published and i need this tag on a page named “news”.

    any help will be appreciated .

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • This needs to go in your page.php wherever you want the teaser text to show up. Do you only want this to show up on that specific page, or every page?

    when you look at page.php in your theme, you should already see a call to the_content

    You would simply replace it with the block of code you have.

    That would then allow you to use the more in a page as you could in a normal post

    Thread Starter sanjeevbhatt

    (@sanjeevbhatt)

    Thank you guys for the help . My page.php has the following code :-

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    				<?php the_post(); ?>
    
    				<?php get_template_part( 'content', 'page' ); ?>
    
    				<?php comments_template( '', true ); ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>

    where exactly do i need to place the code .pardon me if i ask stupid questions as i am new to this coding world .

    my website has the following pages in the order

    home—— about us—— team—– news—— contact us

    Now in the tab “news” i got the following
    date1 — heading 1
    date2 —heading 2
    date3 — haeding 3

    I want to add more tag at the end of headings 1,2,3. only on this page

    I hope i am clear this time and able to explain the query more elaborately.

    Thanks once again

    Ah, since you are using 2011 theme, the first thing you need to do, is make a child theme.
    https://codex.www.ads-software.com/Child_Themes

    After that, you copy the file content-page.php to your child theme and swap out

    <?php the_content(); ?>

    for your above code.

    This will allow the more tag to be used on any page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The “More” Tag on a WordPress Page’ is closed to new replies.