change pagination url

Currently I’m having URL for pagination pages as: http://www.example.com/category_name/page/2 But I need to change this URL structure as: http://www.example.com/category_name/?page=2 etc. any solution?
Category: Web

Pagination doesn't work on static front page

Static front page pagination working fine on localhost. but when i uploaded the to server online its not working. i am using infinite scroll. the issue is only with static front page, when i don't use static front page then it works. here is my code, help will be really appreciated! <?php /* Template Name: Layout 1 */ ?> <?php get_header(); ?> <div class="main"> <div class="container"> <div class="sixteen columns"> <div class="portfolio-all-main"> <?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); …
Category: Web

How to add Pagination to foreach loop to page

I create a page in wordpress series.php and here it the code where I block! <?php $categories=get_categories( array( 'parent' => $cat->cat_ID) ); foreach ($categories as $c) { // what you really want instead of var_dump is something to // to create markup-- list items maybe, For example $idp = $c->term_taxonomy_id; //then i get the data from the database $cat_data = get_option("category_".$idp); ?> <div class="wide-box"> <!-- Content Detail Box --> <a href="<?php echo get_category_link( $idp ); ?>" class="wb-image"><img src="<?php echo $cat_data['original_img']; …
Category: Web

Custom post type archive page pagination

I have set up an archive page for my custom post type reference, where I use a query to get all posts of type reference. This works, but when I try to paginate the result, it doesn't work. Right now, it doesn't even print out the pagination links. EDIT: This was earlier used on a regular page, but I changed it to an archive page. That's when the pagination broke. Here is the source code; Custom post type reference (plugin) …
Category: Web

How do you choose to display specific posts/pages by parent url

I have adjacent posts set up correctly but it's displaying all of the posts/pages. I need it to show specific ones. The easiest way would be by parent URL if that's possible as I need to do this multiple times. So www.example.com/sydney/ would be the URL and every page that uses the sydney parent would be displayed and nothing else. It doesn't have to be this way if there is a better/easier way then I am all ears. /** * …
Category: Web

How to Show Next, Previous, and Page Numbers with wp_link_pages

I want to modify the output of wp_link_pages. Basically what I need is to show Previous and Next buttons and current page/total number of pages. I created the Previous and Next button. Now in between them I want to add a current page and the total pages number. Here is my code wp_link_pages( array( 'before' => '<div class="page-links">' . __(''), 'after' => '</div>', 'next_or_number' => 'next', 'nextpagelink' => __('Next'), 'previouspagelink' => __('Previous'), 'pagelink' => '%', 'echo' => 1, ) ); …
Category: Web

Pagination (on the static front page) shows always the same posts

I have a problem with pagination on my front page. I want to show all posts from a specific category and paginate them. Here is the code if ( is_front_page() ) { $paged = get_query_var( 'page' ) ? get_query_var( 'page' ) : 1; $args = array( 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1, 'cat' => '4', 'page' => $paged, ); $q = new WP_Query( $args ); if ( $q->have_posts() ) { while ( $q->have_posts() ) …
Category: Web

Search not showing all results

EDIT: So I've done some troubleshooting and it seems my theme isn't showing woocommerce search results. The 2017 theme does so I am trying to figure out what my theme is missing. I suspect something in the functions.php file. It's something I'm leaving out, not something I've included that's interfering, because I deleted all my code out of the functions file line by line and nothing changed. I have some custom code I have used elsewhere without any trouble. I …
Category: Web

Added .html to Woocommerce permalink but pagination don't work!

I'm recently added this code to my Wordpress website to add .html for my product category. It worked okay with the category (http://mywebsite.com/parent-category/product-category.html) but when I clicked the pagination, the link turned into (http://mywebsite.com/parent-category/product-category.html/page/2) This is a code that i added to function.php on my site function wpse_178112_category_permastruct_html( $taxonomy, $object_type, $args ) { if ( $taxonomy === 'product_cat' ) add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%.html", $args['rewrite'] ); } add_action( 'registered_taxonomy', 'wpse_178112_category_permastruct_html', 10, 3 ); Please help, I'm just a Wordpress newbie . Thank …
Category: Web

How to add pagination to a post loop in a custom BuddyPress tab

I created a new tab called "Videos" inside of the BuddyPress Profile page. This tab contains all video posts added by that user. The problem is that it only shows the first 12 posts and the pagination does not show up. I did try to include the pagination code provided by the theme but to no avail. Notes: I am using a theme called "VideoTube" The post loop to be paginated is from a custom post type called "video" The …
Category: Web

Homepage has Paged Pages that should not exist, like /page/2/ and on to /page/99999/

The backstory is I noticed the homepage was generating infinite paginated pages. This is a custom built theme. I was using index.php and WP_Query to create 2 small 5 post loops. I figured WP_Query was pulling all of the qualifying posts and then limiting to the most recent 5, so I switched to get_posts with a foreach loop, since my understanding is that doesn't fetch all the posts, only the ones you ask for (and therefore no need for pagination). …
Category: Web

How to add numeric slug for child page in WordPress 5.9?

I am trying to configure WordPress 5.9 to allow numeric slugs for child pages. Drawing from the 2015 answer to a similar question I took the up-to-date code of wp_unique_post_slug, removed || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) and then added it as the following hook to my theme's functions.php. But for some reason, I just get a critical error: "Allowed memory size exhausted". What can I do to allow numeric slugs for child pages? add_filter( 'wp_unique_post_slug', function ( $slug, $post_ID, $post_status, …
Category: Web

Sorting Custom Posts on Archive page with pagination

I've got custom taxonomy archive pages with a drop down list that allows users to re-order/sort the posts. It basically waits for the user to select from the drop down then uses array_merge( $wp_query->query..... to create a new query and re-sort the posts. This works fine. I also use wp-pagination to display numbered pagination. This also works fine. The problem is, when a user re-sorts the list, and then clicks on the pagination to go to page 2 the new …
Category: Web

Pagination in pages (not posts) with the twentythirteen theme?

I wrote a very long page with a lot of content and would like to add a pagination to make it more readable. I added in the texteditor several <!–-nextpage–-> but it doesn't create any pagination, although in the default twentythirteen page template the wp_link_pages function is called <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?> I'm using a child theme …
Category: Web

Disable and redirect pagination of Home

My home is a static page, but Wordpress create enumeration "home/page/2/.../3/" and the only solution found that disable pages generation, also redirecting, is the instruction below, but I would like it to have effect only the home page and not the whole site. Thank you in advance for any suggestions. global $posts, $numpages; $request_uri = $_SERVER['REQUEST_URI']; $result = preg_match('%\/(\d)+(\/)?$%', $request_uri, $matches); $ordinal = $result ? intval($matches[1]) : FALSE; if(is_numeric($ordinal)) { setup_postdata($posts[0]); $redirect_to = ($ordinal < 2) ? '/': (($ordinal > …
Category: Web

How to remove /page/2/ from home page?

First of all: I don't understand the meaning or the action that http://myurl/page/2 does? I checked the Net tab in Firebug and saw that my page takes more than 3 seconds to load /page/2... but I don't need pagination at my front page at all. I don't get where it comes from either. My question: how do I disable / remove this and show it only when pagination is needed? This is the query I am using to get posts: …
Category: Web

Archive pagination not working

I am trying to add pagination for my Archive. I want to show 12 posts per page and then show the 'next' / 'previous' buttons. When I manually change the value of the $paged variable, the 1 into a 2 it works. When I click the Next button on the archive page, it loads a very weird theme page. The url looks like: '/page/2/'. What am I doing wrong? This is the code I wrote so far: <?php global $paged,$wp_query; …
Category: Web

Pagination links missing for first link (1) and previous button? How to get pagination links to work?

I'm trying to add pagination to my WordPress query using pagination_links() however I am getting no links returned for my page 1 links and previous link? Other links are adding the paged query string to the URL which then redirect you to /page/3/ for example. Unsure whether I need to update the query below to add these URL's instead of the query string? Can anyone see what is wrong with the below and how I can get the pagination links …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.