Check to see if page exists problems

Why are you comparing $post->post_name to $this->title? You should be comparing slug to slug. Try changing your comparison from this: if( strtolower( $page->post_name ) == strtolower( $this->title ) ) …to this: if( strtolower( $page->post_name ) == strtolower( $this->slug ) ) Also, I might suggest keeping with the WordPress object conventions with your dynamically created pages, … 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

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

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

Check whether the child page has siblings

Of course it is possible. Just take a look at docs for wp_list_pages So something like this will do the trick: <?php global $post; // assuming there is global $post already set in your context wp_list_pages( array( ‘exclude’ => $post->ID, // exclude current post ‘parent’ => $post->post_parent // get only children of parent of current … Read more

Created pages not showing up in ‘All Pages’ list

The problem was actually the pages having “no language” and WPML seems to hate this. So I just deleted all those pages and re-inserted them with the proper WPML language attributes: // (…) // Create the page $customPage[‘id’] = wp_insert_post( $pageParams ); // Check if WPML parameters are needed if (has_action(‘wpml_set_element_language_details’)) { // Set WPML … Read more

Password Protected Page Not Displaying Content After Entering Password

I’ve also struggled with this. Although I still don’t really understand what causes the problem, I’ve managed to bypass it, by installing a login redirect plugin and changing the standard login URL from www.yourwebsite.com/wp-login.php to www.yourwebsite.com/login. The plugin I used can be downloaded from https://nl.wordpress.org/plugins/rename-wp-login/, but I’m pretty confident that any login redirection plugin would … Read more

One page – Multiple parents?

Not possible natively, parent is simply single field in database. There are plugins that allow to create more complex relationships, such as Posts 2 Posts but it’s unlikely to work with just any widget. Alternatively you can create custom menu with arbitrary structure and use native widget to display it in sidebar.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)