• I am trying to alter the nav link text at the bottom of my pages and posts that now say “older posts” and “newer posts”

    I am using the theme ogee and installed a child theme under it.

    I posted to the theme creators forum, but there has been no response, so I was hoping to get support here.

    I looked thru online help on this and it seems really easy, just finding the place where the code is used and replacing the “next” and “previous” text.

    But I also know that I have already broken the child theme and before trying again I would like a little specific guidance.

    Thanks,

    Henry

Viewing 10 replies - 1 through 10 (of 10 total)
  • @silsurf

    do you have a link to page/s?

    this may help: https://codex.www.ads-software.com/Pagination

    Thread Starter silsurf

    (@silsurf)

    Moderator bcworkz

    (@bcworkz)

    Your theme Ogee uses the_posts_navigation() without arguments to output navigation links. This function accepts arguments where you can specify custom navigation link text. To pass these arguments, copy any templates that use this function, such as index.php and archive.php, to your child theme. Add arguments per the documentation to the child version of the templates. For example:

    the_posts_navigation([
       'prev_text'=>'Earlier',
       'next_text'=>'Newer',
    ]);
    Thread Starter silsurf

    (@silsurf)

    I added:

    the_posts_navigation([
    ‘prev_text’=>’Newer Podcast’,
    ‘next_text’=>’Older Podcast’,
    ]);

    To the functions.php, archives.php, singlepost.php and the index.php all in the child theme.

    Nothing has changed when I load a page or a post, of course I have done something incorrect, or more likely have yet to add the proper code. If you can give guidance here it would be appreciated.

    Henry

    @silsurf

    the code you added is showing at the bottom of the page

    what may help to see where it’s going wrong is a list of all the files you’ve added this to
    AND
    perhaps the code for each file, then we can see where you’ve added the code and what needs to be done to correct the behaviour

    perhaps start with just the one index.php and we can take it from there

    Thread Starter silsurf

    (@silsurf)

    Thanks, here is the index.php file:

    <?php
    /**
    * The main template file.
    *
    * This is the most generic template file in a WordPress theme
    * and one of the two required files for a theme (the other being style.css).
    * It is used to display a page when nothing more specific matches a query.
    * E.g., it puts together the home page when no home.php file exists.
    * Learn more: https://codex.www.ads-software.com/Template_Hierarchy
    *
    * @package ogee
    */

    get_header(); ?>

    <div id=”primary” class=”content-area”>
    <main id=”main” class=”site-main” role=”main”>

    <?php
    if(is_home() && !is_paged() ) {
    if(get_theme_mod( “featured_section_homepage”) ==1 ) {
    echo esc_attr(ogee_featured_section());
    }
    }
    ?>

    <?php if ( have_posts() ) : ?>

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <?php

    /*
    * Include the Post-Format-specific template for the content.
    * If you want to override this in a child theme, then include a file
    * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    */
    get_template_part( ‘content-part/content’, get_post_format() );
    ?>

    <?php endwhile; ?>

    <?php the_posts_navigation(); ?>

    <?php else : ?>

    <?php get_template_part( ‘content-part/content’, ‘none’ ); ?>

    <?php endif; ?>

    </main><!– #main –>
    </div><!– #primary –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    the_posts_navigation([
    ‘prev_text’=>’Newer Podcast’,
    ‘next_text’=>’Older Podcast’,
    ]);

    Moderator bcworkz

    (@bcworkz)

    judgerookie is correct about seeing what you’ve done will make helping you easier, but please do not post large amounts of code here. Use pastebin.com or gist.github.com, then post the link here. Of course the original Ogee theme templates are in the WP repository, so anyone can see what they look like, no need to repost those.

    As it is, I can make a pretty good guess about what you did. You added our code to the bottom of the template as HTML content. For PHP code to execute, it must be within <?php ?> delimiters. But don’t add these to what you have, it’s just FYI.

    What you need to do is locate the original the_posts_navigation(); call on each template and replace it with our code. It will already be within PHP delimiters, so no need to worry about that part.

    Thread Starter silsurf

    (@silsurf)

    ahh, ok that makes sense

    Thread Starter silsurf

    (@silsurf)

    All done, thanks for the fantastic support!

    Moderator bcworkz

    (@bcworkz)

    You’re welcome!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Changing NAV links text?’ is closed to new replies.