What is the optimal way to filter out subpages from admin?

This works for our needs: # Parent filtering function wps_restrict_manage_posts() { global $typenow; # only run this filter on page post type if ( $typenow == ‘konverentsid’ ) { # Parent Page Filter (HTML) $args = array( ‘post_type’ => ‘konverentsid’, ‘child_of’ => 0, ‘show_option_none’ => __(‘Show all pages’), ‘depth’ => 1, ‘name’ => ‘wps_page_filter’, ‘selected’ … Read more

Add new page with preselected parent

welcome to WPSE! This answer from Mike Schinkel was useful to find a solution* for Get QueryString values with jQuery. *(not used anymore, a simple $_GET does it) It’s also worth noting that, in that same answer, Mike also links to this other important Question: What is the best way to add custom javascript files … Read more

WP_Query not retrieving by random order under parent

Turns out the “Custom Page Order” plugin was causing the randomization error… or rather, not allowing any randomization as it overrides it completely. Disabled the plug-in. Whenever I need to change orders, I can enable the plugin, shuffle pages around, and then disable. But the need for this is decreasing more and more as we … Read more

Get Order of Meta Box in a Page/Post

It’s not that hard: There’s a user Meta entry for that. You can not only retrieve the order, but also which ones are hidden (just to get one step further). # Meta Box Order $meta_box_order = get_user_meta( wp_get_current_user()->ID ,sprintf( ‘meta-box-order_%s’, get_post_type() ) ,true ); # Hidden Meta Box $meta_box_hidden = get_user_meta( wp_get_current_user()->ID ,sprintf( ‘metaboxhidden_%s’, get_post_type() … Read more

Redirect to a page if ancestors is empty

The simple answer is wp_redirect($url);, but it’s a tricky beast to use as you can only use it before any page output. So basically, what you have would need to be right at the top of your page This example is making the assumption that you are using this in single.php? – $post_id = $post->ID; … Read more

Do I really need the div class entry?

No specific markup is required in a theme. The only exception are themes published on wordpress.org, they have to follow the guidelines. And even there, <div class=”entry”> is not required. The only parts you have to use are these: while ( have_posts() ) { the_post(); print ‘<h2>’ . get_the_title() . ‘</h2>’; the_content(); wp_link_pages(); }

CMS: Making complex pages editable by the end user

Your question is quite interesting because (as I understand it )it addresses a very important aspect of coding – Planning . And planning a good structure requires a well established knowladge about the platform you are using. The question ( again – for my understanding ) can not be answered by code but more like … Read more

Redirect before post page

The determination to redirect needs to be made prior to headers being sent to the browser. Otherwise you risk PHP warnings (i.e. errors) when the page is rendered. This makes the timing of the use of wp_redirect() incorrect in the other answers. (The function is right, it’s just used incorrectly.) If you are going to … Read more