Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?

look for the string page/ and capture just the part of the url before it with strpos and substr: $url=”/players/type/pros/page/3/”; $find = ‘page/’; $trimmed_url = substr( $url, 0, strpos($url, $find) ); EDIT – so in the context of your question you could use: $url = $_SERVER[‘REQUEST_URI’]; $find = ‘page/’; $pos = strpos($url, $find); if($pos): $url … Read more

Show single post then all posts (with pagination)

Pagination does not work well will with secondary queries. First, the ordinary pagination functions depend upon the main query in the global variable $wp_query. They won’t work with secondary queries. There are already a number of questions here about that if you search the site. Second, trying to paginate secondary queries tends to result in … Read more

Possible to paginate on single.php?

I think the easiest implementation would be to put your infinite scroll in category.php, and then, either using Dashboard -> Settings -> Reading -> Posts per page, or via direct query modification, display one post per page. Otherwise, depending on how you’re implementing the infinite scroll, you could make use of next_post_link() and previous_post_link(), both … Read more

Custom category template pagination problem

Well, modifying this codilight_lite_custom_paginate() function is not a good option. Cause if it gets modified then it might cause problem on other pages. So if you want to paginate your archive.php child category foreach loop then remove the codilight_lite_custom_paginate() function and customize your archive.php page like below – <?php /** * Category Template: Custom */ … Read more

Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?

For the record, I just found a new/different way to accomplish this goal. It’s not quite the same, but it does allow me to insert a new post type after every X posts in my original loop. This is the source: https://www.gowp.com/blog/inserting-custom-posts-loop/ The method was done via the code below, which essentially injects a new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)