See:
https://pods.io/forums/topic/pagination-desc-problem/
Please provide the version of Pods you are running: 2.7.9
Informação de Debug WordPress Version: 4.9.8
PHP Version: 7.0.25
MySQL Version: 5.6.32
Server Software: Apache
Your User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Session Save Path: /tmp
Session Save Path Exists: Yes
Session Save Path Writeable: Yes
Session Max Lifetime: 1440
Opcode Cache:
Apc: No
Memcached: No
OPcache: No
Redis: No
Object Cache:
APC: No
APCu: No
Memcache: No
Memcached: No
Redis: No
WPDB Prefix: 1fa_
WP Multisite Mode: No
WP Memory Limit: 40M
Pods Network-Wide Activated: No
Pods Install Location: /home/rogeriod/public_html/wordpress/sortemania/wp-content/plugins/pods/
Pods Tableless Mode Activated: No
Pods Light Mode Activated: No
Currently Active Theme: Astra Child
Currently Active Plugins:
Activity Log: 2.4.1
Add Admin CSS: 1.6
Admin Trim Interface: 3.2
All-in-One WP Migration: 6.73
All 404 Redirect to Homepage: 1.13
Async JavaScript: 2.18.06.13
Better Font Awesome: 1.7.1
Coming Soon Page & Maintenance Mode by SeedProd: 5.0.20
Contact Form 7: 5.0.3
Disable Search: 1.6.1
Disable WordPress Theme Updates: 1.1
Enable Media Replace: 3.2.7
Error Log Monitor: 1.6.1
Google Analytics for WordPress by MonsterInsights: 7.1.0
Google Pagespeed Insights: 3.0.5
Image Sizes: 2.0.0
Leverage Browser Caching: 1.7
Mapping multiple URLs redirect same page: 3.0
PHP code snippets (Insert PHP): 2.0.6
Pods - Custom Content Types and Fields: 2.7.9
Remove Query Strings From Static Resources: 1.4
Rename wp-login.php: 2.5.5
Responsive Lightbox & Gallery: 2.0.5
Restrict Media Library Access: 1.0
Save with keyboard: 2.3
Simple Image Sizes: 3.2.0
Smush: 2.8.0.1
Specify a Vary: Accept-Encoding Header: 1.0.0
SVG Support: 2.3.15
User Role Editor: 4.45
WP Rollback: 1.5.1
WP SEO Structured Data Schema: 2.5
Yoast SEO: 8.0
Copy and Paste the JSON Export from **Pods Admin, Migrate: Packages, Export** in WordPress admin here
Additional context
Add any other context about the problem here.
Possible Workaround
If you have discovered a workaround, please include it below.
Code from the forum report above:
$params = array(
'orderby' => 'data_sorteio DESC',
'limit' => 3
);
$pods = pods('sorteio');
$pods->find($params); // sorteio a acontecer (último registro)
while ($pods->fetch() ) {
if ($pods->field('imagem_resultado_sorteio')) { // não mostra edição não sorteada
echo "item" . $pods->display('edicao_sorteio') . "<br>";
}
};
echo $pods->pagination( array( 'type' => 'advanced' ) ) ?>
Unfortunately, there's no indication of what page this particular issue is running on for clarification. I also don't believe @rogeriodec provided anything to duplicate the configuration.
Sorry, I accidentaly closed this issue.
I leave this link for you to test: http://sandbox.sortemaniasudoeste.com.br/results.
In this case, the parameters are as follows:
$params = array(
'orderby' => 'data_sorteio DESC',
'limit' => 3
);
And as you can see, the first page should show the last 3 items, but pods only show 2.
In any case here is the code: https://pods.io/forums/topic/pagination-desc-problem/#post-199019
Did you test the output of $pods->total() ?
Did you check that your 3rd (missing) item has a imagem_resultado_sorteio set?
Did you deactivate all other Plugins and use a default theme?
Just to make sure there isn't some other code interfering with pods!
_Did you test the output of $pods->total() ?_
I've inserted at the end. It shows 3:
echo $pods->pagination( array( 'type' => 'advanced' ) );
echo "<br>total: " . $pods->total();
Look: http://sandbox.sortemaniasudoeste.com.br/resultados/
_Did you check that your 3rd (missing) item has an imagem_resultado_sorteio set?_
Yes. On page one, you'll see items 15 and 14. If you advance to the next page you'll see items 13, 12 and 11.
_Did you deactivate all other Plugins and use a default theme?_
All plugins have been disabled (except Pods) and I've activated the Twenty Sixteen theme. But as you can see, the problem persists.
feels like there is an item no 16 that has no image ;)
what's the output of $pods->total_found() ?
You are right.
'find' is bringing 16 items.
I should have put a where clause inside $params, so 'find' would only bring the 15 items.
I did it:
$params = array(
'limit' => 3,
'where' => 'imagem_resultado_sorteio IS NOT NULL',
'orderby' => 'data_sorteio DESC',
);
Also I removed the if ($pods->field('imagem_resultado_sorteio')) {
However, now I get this error:
Database Error; SQL: SELECT DISTINCTt.* FROM1fa_postsAStLEFT JOIN1fa_postmetaASdata_sorteioONdata_sorteio.meta_key= 'data_sorteio' ANDdata_sorteio.post_id=t.IDWHERE ( ( imagem_resultado_sorteio IS NOT NULL ) AND (t.post_type= "sorteio" ) AND (t.post_statusIN ( "publish" ) ) ) ORDER BYdata_sorteio.meta_valueDESC,t.menu_order,t.post_title,t.post_dateLIMIT 0, 3; Response: Unknown column 'imagem_resultado_sorteio' in 'where clause'
It seems Pods is not recognizing imagem_resultado_sorteio field.
How to fix this?
use imagem_resultado_sorteio.meta_value - https://pods.io/docs/code/pods/find/ there is a table at the end of the page listing all the options!
i'm gona close the issue - feel free to ask further questions!
Changing to 'where' => 'imagem_resultado_sorteio.meta_value IS NOT NULL', I got:
Database Error; SQL: SELECT DISTINCT t.* FROM 1fa_posts AS t LEFT JOIN 1fa_podsrel AS rel_imagem_resultado_sorteio ON rel_imagem_resultado_sorteio.field_id = 98 AND rel_imagem_resultado_sorteio.item_id = t.ID LEFT JOIN 1fa_posts AS imagem_resultado_sorteio ON imagem_resultado_sorteio.ID = rel_imagem_resultado_sorteio.related_item_id LEFT JOIN 1fa_postmeta AS data_sorteio ON data_sorteio.meta_key = 'data_sorteio' AND data_sorteio.post_id = t.ID WHERE ( ( imagem_resultado_sorteio.meta_value IS NOT NULL ) AND ( t.post_type = "sorteio" ) AND ( t.post_status IN ( "publish" ) ) ) ORDER BY data_sorteio.meta_value DESC, t.menu_order, t.post_title, t.post_date LIMIT 0, 3; Response: Unknown column 'imagem_resultado_sorteio.meta_value' in 'where clause'
oh my fault - that's an image count's as file/relationship - imagem_resultado_sorteio.ID
Now it worked. Thank you very much!
You're welcome! The best way to say thanks is to leave a 5 star review at https://wordpress.org/plugins/pods/ ​and​ (if you're feeling especially generous) become a Friend of Pods at https://pods.io/friends-of-pods/
Done! Thanks!
Most helpful comment
Now it worked. Thank you very much!