How to use ‘depth’?

On recursive methods, I usually add a $depth parameter: function my_function($depth = -1) { if ($depth === 0) { return array(); // or any other value insisting an empty or false result } // do something $result = array(); while ($some_condition) { $result = array_merge($result, my_function($depth – 1)); // decrease $depth value } // maybe … Read more

How to get WordPress Adminmenu items?

Menu and submenu data is accessible through the $menu and $submenu globals: add_action( ‘admin_notices’, ‘so19890599_print_menus’ ); function so19890599_print_menus() { global $menu, $submenu; echo ‘<pre>’; print_r( $menu ); echo ‘</pre>’; echo ‘<pre>’; print_r( $submenu ); echo ‘</pre>’; }

Trying to fix multiple category drop down

The HTML seems correct, as Price dropdown contains the right cat ID. I guess this is a JS problem, my first guess is that you shouldn’t use the same variable name in both scripts. Replace dropdown by dropdown_price for second one, like : <!–DROPDOWN SORT CATEGORY 2–> <script type=”text/javascript”> var dropdown_price = document.getElementById(“cat2”); function onCatPriceChange() … Read more

Too few arguments for printf() [closed]

printf( __( ‘%1$s &#8211; %2$s’, ‘erudite’ ), the_date( ”, ”, ”, true ) ) expects two strings; you’ve only offered one (the_date()). If you want to use two strings, you have to give it two strings. If you want printf() to use the_time() and $previousday, you need to tell it so: printf( __( ‘%1$s &#8211; … Read more

Arrange Category post manually when displayed

So, if I can clearly get you, you want to sort the order of your posts. I found the following plugin best fit for the purpose: Post Type Order – WordPress Plugin After installing the plugin, you will get a new submenu under “Posts” (and under all other Custom Post Types). You can order the … Read more