Remove trailing slash
Remove trailing slash
Remove trailing slash
I changed my approach in the end. I just called a single query and added the logic to check the date of the last post was in a different month: $today = date(“r”); $articledate = get_the_time(‘r’); $difference = round((strtotime($today) – strtotime($articledate))/(24*60*60),0); if ($month_sort == true && ($difference <= 7) && $current_week == null) { $vpost_count … Read more
when writing this question we suddenly thought that we did not try to change the permalink. After changing the permalink to another unique value it worked like a charm. So still not sure what was causing this issue but the above solved the issue. If anyone has a clue why the permalink was causing the … Read more
What is wrong with my code ? pagination does not show up
get_previous_post() and get_next_post() are deprecated. You should use get_previous_post_link() and get_next_post_link() or even better the wrapper functions the_post_navigation() or get_the_post_navigation(). If you don’t know how to use them, see the single.php template of the twentyfifteen theme that comes with WordPress by default. You can also see how these functions are implemented in the link-template.php file … Read more
You’re trying to retrieve a set of posts, and display them, in a random order. Firstly: Indent your code to prevent bugs, as it reads, there is a closing endif; in your questions code but no if statement was ever opened. If you had indented correctly this would be trivial to spot, good editors will … Read more
here you just need to change on $args array. where you have pas wrong argument. $args = array ( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3, ‘paged’ => $paged );
I finally figured out how to fix the issue I had. I added the following into my rewrite_rules function: add_rewrite_rule(‘^mysearch/location/([^/]+)/page/([0-9]{1,})/?$’,’index.php?page_id=200&location=$matches[1]&paged=$matches[2]’,’top’); So now my URLs are exactly as I wanted them: /mysearch/location/SUBMITTED-INFO/page/WHATEVER
I found solution. Grouping duplicated posts by ID. Just add this code to select query: GROUP BY wp_posts.ID Whole code (maybe it will help someone – not many examples of working pagination with select query around the internet :)): <?php global $wpdb; $date = date(“Y-m-d”); $querystr = ” SELECT * FROM wp_posts JOIN wp_ftcalendar_events ON … Read more
custom query – offset to pagination