Skip to content
Advertisement

Can’t set posts_per_page nor order/sort my shortcode function

I have been working on a new function where I can simply add a shortcode to show child pages of a specific page I did set. Everything worked fined and looked good until I wanted to order/sort them and also set a limit.

Here is my code

JavaScript

I have tried with

  • wp_reset_postdata();
  • wp_reset_query();
  • In $args adding posts_per_page
  • In $args adding showposts

Does anyone see what I have missed here ?

Advertisement

Answer

Add parameter for sorting

JavaScript

Replace code from

JavaScript

TO

JavaScript

Final Conclusion. Also change parent to post_parent

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement