Separate page for pagination possible?

Question

This is how my index.php looks like for my custom theme (I’m not sure if Line 4-5 is necessary).

When I put pagination in the home or post, I would like to be able to take the user to a separate custom page with just the posts as the current home or post custom page has many DIVs that I don’t want to show in the /page/2/3/4 etc.

<?php get_header(); ?>
<?php if(is_home() || is_front_page()){ ?>
    <?php get_template_part('templates/content','home'); ?>
    <?php } else if (is_home()){ ?>
        <?php get_template_part('templates/content','home'); ?> <!-- home  -->
    <?php } else if (is_page()){ ?>
        <?php get_template_part('templates/content','page'); ?> <!-- page content -->
    <?php } else if (is_single()){ ?>
        <?php get_template_part('templates/content','post'); ?> <!-- post content -->
    <?php } else { ?>
        <?php get_template_part('templates/content','cat'); ?> <!-- category -->
    <?php } ?>
<?php get_footer(); ?>

Basically, if someone clicks on Page 2/3/4 etc, I want them to see this new custom template part:

<?php } else if (is_paginated()){ ?>
  <?php get_template_part('templates/content','paginated'); ?>

How can I achieve this?

0
Elaine Byene 1 month 2022-10-26T00:21:57-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse