Hi,
You can find the files here:
http://dl.dropbox.com/u/103580364/temp/forum/page-homepage-loop.php
http://dl.dropbox.com/u/103580364/temp/forum/td_block_3.php
http://dl.dropbox.com/u/103580364/temp/forum/td_data_source.php
There you can see the exact locations to make the changes.
The pagination issue is caused by offset parameter. I set offset argument to 5 in order not to repeat the posts in the slider. But this causes the “paged” attribute in WP_Query to be ignored. This is documented in WP Codex:
offset (int) – number of post to displace or pass over.
Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination (Click here for a workaround).
Making Custom Queries Using Offset And Pagination
http://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
I adopted the solution above to my situation as here:
Newspaper-child\functions.php
add_action('pre_get_posts', 'myprefix_query_offset', 1 );
function myprefix_query_offset(&$query) {
//Before anything else, make sure this is the right query...
$not_in_ajax_call = get_permalink();
$in_home_page = ! is_page('');
if ( $not_in_ajax_call && $in_home_page ) {
return;
}
if ( empty( $query->query['offset'] ) ) {
return;
}
$offset = $query->query['offset'];
//Next, determine how many posts per page you want (we'll use WordPress's settings)
$ppp = get_option('posts_per_page');
//Next, detect and handle pagination...
if ( $query->is_paged ) {
//Manually determine page query offset (offset + current page (minus one) x posts per page)
$page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );
//Apply adjust page offset
$query->set('offset', $page_offset );
}
else {
//This is the first page. Just use the offset...
$query->set('offset',$offset);
}
}
-
This reply was modified 12 years by
mertnuhoglu.
Hi Marius,
The problem is caused by offset attribute in WP_Query as described here:
offset (int) – number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination (Click here for a workaround).
A workaround is described here.
I try to implement that solution. Any help will be appreciated.
I still have the problem. I have just found out the post listings are repating even in infinite scroll mode. See here:
https://forum.tagdiv.com/topic/posts-are-repeated-in-infinite-scroll-feature/
I found a solution. Here is it:
Edit Newspaper/includes/app/shortcodes/td_block_3.php:
$td_query = &$td_data_source->get_wp_query($atts); //by ref do the query
Add the following line before it:
$atts['offset'] = 5;
$td_query = &$td_data_source->get_wp_query($atts); //by ref do the query
Edit Newspaper/includes/content_builder/td_data_source.php
extract(shortcode_atts(
array(
'category_ids' => '',
'tag_slug' => '',
... ),
$atts
Add the following element to the above array:
'offset' => 0,
And add the following line after $args created:
$args['offset'] = $offset;
-
This reply was modified 12 years by
mertnuhoglu.
An alternative solution is this:
Inside Newspaper/category.php:
$tdc_layout = get_tax_meta($cur_cat_id, ‘tdc_layout’);
Replace with:
$tdc_layout = ‘9’;
I set the listing as infinite scroll. So the pages are not visible anymore.
Hi, I deactivated all the plugins but the problem still continues. Please check the following two pages. They are exactly the same:
Hi Marius,
Different pages show the same posts. Look at the following screenshots:
http://dl.dropbox.com/u/103580364/temp/000737.jpg
http://dl.dropbox.com/u/103580364/temp/000738.jpg
2. and 3. pages are exactly the same.
Hi,
The Theme Customizer in my theme doesn’t include the option to set Word Length of Module 2:
I need this feature too.
