Position Bootstrap post pagination links at the end of the row in WordPress

My Wordpress custom post type has numeric pagination links within a Bootstrap row instead of appearing below the post thumbnails. How can I move them to a new row below the thumbnails without creating a row within a row?

Bootstrap version: 3.3.7

https://i.sstatic.net/PR2j5.jpg

I have tried setting a new class with absolute positioning, but it didn't work as desired. The pagination links must remain within the loop.

<div class="row">

        <?php
        $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
        // WP_Query arguments
        $args = array(
            'post_type'              => array( 'video' ),
            'post_status'            => array( 'publish' ),
            'nopaging'               => false,
            'posts_per_page'         => 3,
            'paged' => $paged
        );

        // The Query
        $video = new WP_Query( $args );

        // The Loop
        if ( $video->have_posts() ) {
            while ( $video->have_posts() ) {
                $video->the_post(); ?>

                <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
                    <figure class="snip1567">
                        <img src="<?php the_post_thumbnail_url(); ?>" class="img-responsive" alt="<?php the_title(); ?>" />
                        <figcaption>
                            <h3>Graphic Design</h3>
                            <p><?php the_title(); ?></p>
                        </figcaption>
                        <div class="hover"></div><i class="fa fa-play-circle-o"></i>
                        <a href="<?php the_permalink(); ?>"></a>
                    </figure>
                </div>

            <?php } ?>

                <?php $big = 999999999; // need an unlikely integer

                echo paginate_links( array(
                    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                    'format' => '?paged=%#%',
                    'current' => max( 1, get_query_var('paged') ),
                    'total' => $video->max_num_pages
                ) );
                ?>

        <?php } else {
            // no posts found
        }

        // Restore original Post Data
        wp_reset_postdata();
        ?>

CSS

/* 
 * Custom Video Thumbnail Styles 
*/
.snip1567 {
    // CSS styles for video thumbnail
}

/*

 * Pagination Link Styles 
*/
.page-numbers {
    // CSS styles for pagination links
}

HTML Output

<div class="row">
                <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
                    // HTML output for video thumbnail
                </div>

                <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
                    // HTML output for video thumbnail
                </div>

                <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
                    // HTML output for video thumbnail
                </div>

                // Pagination links displayed here

 </div>

Answer №1

Embed the .page_numbers within a div element with the id link_container and apply styling. Ensure a clear fix is implemented. See example below:

#link_container{
clear: both;
padding-left: 25px;
}

Snippet provided below

/* Custom styles for video thumbnails */

.snip1567 {
  /* Styling for video thumbnail container */
}

/* CSS for snip1567 element and its child elements */

/* Paging link element styling */
.page-numbers {
  /* Styling for page numbers */
}

.page-numbers.current,
a.page-numbers:hover {
  /* Styling for current page and hover state */
}

#link_container {
  clear: both;
  padding-left: 25px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<div class="row">
  <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
    <figure class="snip1567">
      <img src="image_path" class="img-responsive" alt="Alt text">
      <figcaption>
        <h3>Graphic Design</h3>
        <p>Description</p>
      </figcaption>
      <div class="hover"></div><i class="fa fa-play-circle-o"></i>
      <a href="video_link"></a>
    </figure>
  </div>

  <!-- Add more figure elements with different content here -->

  <div id="link_container">
    <span class="page-numbers current">1</span>
    <a class="page-numbers" href="page_2_link">2</a>
    <a class="next page-numbers" href="next_page_link">Next »</a>
    <div>

    </div>

Click here for a demo with resizable window

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for submitting a form using alternative methods of action

Currently, I am facing a challenge in retrieving information from a database using submit buttons with the same name. I assign a value to these buttons, which corresponds to the id of the row, enabling me to perform different actions. However, I am unsure ...

Obtain user input and showcase it on the screen using a combination of Ajax and PHP

Whenever a user inputs a value in the textbox, it should dynamically display on the screen. I have successfully implemented this feature once, but I am encountering difficulties with implementing it for a second input. Your help is greatly appreciated. fu ...

What are some ways to reuse an angular component multiple times?

I am utilizing an angular component to dynamically load charts into my widget: Below is an example of the component: angular.module("generalApp").component("chartPie", { template: "<div class=Pie></div>", bindings: { data: "=", }, control ...

Utilizing Ajax Blob URL for Audio Streaming

My goal is to retrieve audio data using an Ajax request and load it into an audio element. However, I'm running into an issue where the player does not seem to work properly. The play button remains disabled as if nothing has been loaded. Below is a s ...

Selector in CSS targeted by using target selector

When you click on the anchor tag "Click me," is there a way to use only CSS to display the p tag with the text "This is my answer"? I am aware that placing the p tag after the anchor tag is a solution, but I am curious if there is a method to achieve this ...

Searching for elements by tag name in JavaScript

Recently, I attempted to create JavaScript code that would highlight an element when a user hovers their cursor over it. My approach involves adding an event listener to every child within the first "nav" tag in the current document: let navigation = docum ...

"Showcase a Pair of Images with Just a Single Click. Leveraging PHP and

With two div boxes, one for Input and the other for Output as displayed below: https://i.sstatic.net/C8dhm.png My goal is to upload an image using PHP and store it in both the Input and Output folders. Upon clicking the Submit button, I want the image f ...

Using NodeJS and EJS to Display MySQL Query Results

I am currently working on a project where I need to display data retrieved from a MySQL query in an HTML table. However, when I attempt to do so, I encounter the following output: [object Object],[object Object],[object Object],[object Object],[object Obj ...

Issues with displaying images in CSS when using HTML 5 canvas drawing

In attempting to draw an image on a canvas using a pre-loaded image and CSS, such as: img.style.backgroundColor="red"; ctx.drawImage(img,0,0,100,100); I have observed that the image is drawn without incorporating the CSS modifications. Are HTML canvases ...

Is there a way to adjust the opacity of a background image within a div?

I have a lineup of elements which I showcase in a grid format, here's how it appears: https://i.stack.imgur.com/JLCei.png Each element represents a part. The small pictures are essentially background-images that I dynamically set within my html. Up ...

The ACF function in Wordpress fails to provide any output

When I parse the data using the variable, everything works fine. However, there seems to be an issue with how the HTML output is being wrapped in my echo statement. <? if( get_field('pre_video_set_label_name') ) { echo "<h3> ...

Add an event listener to a dynamically created div block through jQuery when it is clicked

When the page loads, a dynamic div appears that is visible to the user and in Firebug, but is not available in the page source. The content within this div changes dynamically. I am attempting to bind a click event to this div so that when a user clicks o ...

How can I line up two divs horizontally within a container div?

Apologies if my terminology is off, I am relatively new to this. My goal is to align two divs horizontally, one containing an image and the other the message content. I have created a messaging user interface. Everything was functioning correctly until I ...

Creating an interactive R Shiny application with custom CSS styling and a modal

I am encountering an issue when trying to incorporate a modal dialog with a specific CSS style within a R Shiny app. Individually, I can successfully implement a modal dialog without the CSS style and apply the CSS style without any issues. However, when a ...

Adding Space Before Bullet Points in HTML: A Quick Guide

Is there a way to add space before bullet points? My requirements are as follows: This is paragraph 1 The first text line The second text line This is paragraph 2 The first text line The second text line I would greatly appreciate any ...

Only render the div content in jQuery when the user has made a selection

Looking to optimize my website by incorporating tabs with a large amount of HTML content without slowing down the page load. Is there a way to use jQuery to load the div content only when each tab is selected? The basic structure of the HTML code would be ...

Creating consistent image placement across all divs: a step-by-step guide

html { font-family: 'Open Sans', sans-serif; } body {margin: 0; padding: 0; } #wrapper { padding-left:50px; padding-top:30px; } #third, fifth { background-color:#E8E8E8 ; } img[src^="my_menu.png"] { z-index:10; } #s ...

Ways to utilize a single HTML page for various URLs while changing one variable value based on the queried URL

My current HTML page structure looks like this: <body ng-controller="DashboardDisplay" onload="submit()"> <div class="container-fluid" > {{scope.arr}} </div> </body> <script> var myApp = angular.module(&apos ...

Div with wide width and captivating perspective

Recently, I've been experimenting with perspective and 3D transformations, and I've realized why my div isn't displaying at full width despite setting it in the CSS. However, I'm interested in creating a responsive layout where the div ...

Align images of varying sizes vertically within div containers, even when the image is larger than the div itself

I'm facing a challenge when it comes to aligning images vertically inside divs. The problem arises due to the following conditions: The images will have varying and unknown sizes. These images are larger than the divs they are contained in, requiri ...