Site logo

[Support request] Can the Elements – Archive Navigation work on a custom results.php page?

Home Forums Support [Support request] Can the Elements – Archive Navigation work on a custom results.php page?

Home Forums Support Can the Elements – Archive Navigation work on a custom results.php page?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2057452
    Spencer

    Hi there,

    I am using a custom results.php page to show the results of a filter. (search and filter pro on ACF fields)

    I did have it set up at one stage to use the Archive page and the Archive Navigation worked great.

    I didn’t think it was working on the reults.php pag so I installed wp-navi to see if that could help me.

    I noticed that it was actually showing on the second page of results.

    I am just wondering if I can get it working on the results.php page so I can get rid of the wp-navi (trying really hard to use minimal or only generate press plugins.

    This is page 2 of the results – https://dev.scenichelicopters.com.au/margaret-river-helicopter-flights-and-tours/?sf_paged=2
    This is the bottom of the code – is there some generatepress magic hook or action that I am missing?

    
                <div class="st-button-wrapper">
                    <div class="st-button-col">
                        <a class="button" href="<?php the_field('book_url'); ?>">Book Now</a>
                    </div>
                </div>
            </div>
    
            </div>
            </div>
            <?php
    	}
    	?>
    
    	<div class="pagination">
    
            <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
            <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
            <?php
            /* example code for using the wp_pagenavi plugin */
            if (function_exists('wp_pagenavi'))
            {
                echo "<br />";
                wp_pagenavi( array( 'query' => $query ) );
            }
            ?>
    	</div>
    	<?php
    }
    else
    {
        echo '<div class="not-found-container">';
        echo '<div class="not-found-item">';
        echo '<h1>Uh oh</h1>';
        echo '<p>We dont seem to have tour for that search  Please refine your filter and try again or get in touch</p>';
        echo '</div>';
        echo '</div>';
    }
    ?>

    Many thanks!

    #2057827
    David
    Staff
    Customer Support

    Hi there,

    i can see the Block Element Archive Navigation button container on the first page – its just empty. Is there two buttons in the container one of which is set to Next page ?

    #2058023
    Spencer

    Hi David,

    Yes I think so, I have a froward and back button dynamically linking to next and previous posts.
    https://drive.google.com/file/d/1KpHdmoSKLaFG-_8WMf7KKDLc8M7eWgLE/view?usp=sharing

    Thanks

    #2058024
    Spencer

    Actually it seems that the page-navi plugin is helping it load, as it does not show at all when the plugin is disabled.
    Probably because it is not an archive page?

    Is there a way I can manually add the hook?

    #2058344
    David
    Staff
    Customer Support

    So here is where the Themes Post Navigation gets hooked in:

    https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/inc/structure/post-meta.php#L557

    the hook it uses is the generate_after_loop which is found in the archives.php.

    Although you could include the hook in your own template, to be honest i am not sure what it would do.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.