Tag Info

New answers tagged

0

I found the answer. I had searched high and low yesterday, but today I finally found it: http://wordpress.stackexchange.com/a/143837/10595 add_action('template_redirect', function() { if ( is_singular('posttype') ) { global $wp_query; $page = (int) $wp_query->get('page'); if ( $page > 1 ) { // convert 'page' to 'paged' ...


0

function enqueue_lazyload() { wp_enqueue_script('jquery_lazy_load', get_stylesheet_directory_uri() . '/js/jquery.lazyload.min.js', array('jquery'), '1.9.1'); } add_action('wp_enqueue_scripts', 'enqueue_lazyload'); Next, we have to add a small bit of Javascript to our footer to get the lazy load plugin to recognize images. You can see how this works on ...


0

Just inspect the current post content for <!--nextpage-->: function wpse_check_multi_page() { $num_pages = substr_count( $GLOBALS['post']->post_content, '<!--nextpage-->' ) + 1; $current_page = get_query_var( 'page' ); return array ( $num_pages, $current_page ); } On page 2 of 3 that returns: Array ( ...


0

Did you update your permalink settings? Sometime when WordPress find a new term or texonomy, it needs to be updated, I mean Save the change again (by or without changing URL structure). Please check this screenshot if you don't know the settings page - http://prntscr.com/8618mg


0

Ok, found the issue. By analizing the generated query, I realized that it rightly searched for current language posts. I'm currently use polylang as the multilingual plugin, and it correctly associate posts with a 'language' taxonomy. Now, I had far more 10 project posts but only 10 where of the current language. All fine now.


0

I figured it out! I had too many parameters trying to match and had to replace "[^/]+" with "(.+?)" i was able to get this with just one rewrite rule here is the final code: add_rewrite_rule( 'resources/(.+?)(/page/([0-9]+))?/?$', 'index.php?taxonomy=res_category&term=$matches[1]&paged=$matches[3]', 'top'); now the problem i have now i get a 404 ...


0

At first blush, your code looks solid. Two suggestions: 1) Try putting the longer rewrite rule before the shorter one. It's possible that the first one is being matched (because it is a subset of the longer one) and then not proceeding to check the longer one. 2) Whenever you modify rewrite rules, you have to flush and reload the rewrite rules for them to ...


1

I don't know what do you mean by a 'custom loop' (perhaps you are using a custom WP_Query object?) but here is how I would do it in a normal situation (code hasn't been tested): Note: My initial solution made use of the add_rewrite_endpoint function which turns out to be useless in terms of making pagination work. function wt_rewrite_rule() { ...


0

I have figured out the problem. There was a naming clash between my post type insights and the page name (also insights) which was confusing WordPress. Changing the post type to the singular insight fixed it.


0

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 ...


0

I had the same case and I was going crazy and tested Disable canonical redirection for this case and worked. Maybe this will also help I'm not sure if this would be the best way to do this , however. function no_canonical( $url ) { return false; } function adjust_show_request( $request ) { if ($request->query_vars['post_type'] === ...



Top 50 recent answers are included