Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are two ways you can implement this code. It looks like right now you are sort of in between the two.</p> <p>The first way would be to add your pagination code directly into the template that it will be used in somewhere inside the loop (most likely somewhere right before the closing <code>&lt;?php endwhile; ?&gt;</code> tag). If you are using a single.php template, you would put it in there, if not, put it in index.php. The placing of it inside of the loop depends on where you want the pagination to appear on your page.</p> <p>The second way is to add the pagination code to the functions.php file (which you have done). However, you will need to revise your code a bit for this. You need to wrap the code within a function, and name that function something. I've used <code>your_custom_pagination</code> for an example. Your functions.php file is most likely already wrapped in php tags, so I have removed those.</p> <pre><code>function your_custom_pagination() { global $wp_query; $total = $wp_query-&gt;max_num_pages; if ( $total &gt; 1 ) { if ( !$current_page = get_query_var('paged') ) { $current_page = 1; } echo paginate_links(array( 'base' =&gt; get_pagenum_link(1) . '%_%', 'format' =&gt; '?paged=%#%', 'current' =&gt; $current_page, 'total' =&gt; $total, 'mid_size' =&gt; 4, 'type' =&gt; 'list' )); } } </code></pre> <p>Then you'll need to go into the template that you are using and place this code <code>&lt;?php your_custom_pagination(); ?&gt;</code> into the same spot I illustrated above to call the pagination function.</p> <p>I haven't actually tested your code, so assuming it's valid everything should work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload