404 error on second page load for child-pages

I never found the real reason for this issue. However this “bugfix” did solve the issue for me: add_action( ‘template_redirect’, ‘handle_strange_bug’, 10 ); // “Fixes” the strange bug… function handle_strange_bug() { global $post; $post_id = 123; // This is the post that makes problems. /* ===== Start of the bugfix. * * If the $post->ID … Read more

Get current post’s child page?

$ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; $parent should be the topmost page parent. However, if you are using a WordPress generated menu there is a pretty good chance that there is already a item identified by a CSS class as the parent. Take a good look at the … Read more

How to accomplish a child page navigation?

I’m outlining a solution for you, it uses get_children to determine if there are any, then conditionally sets up the post id $p_id for the child_of parameter, so that the list of child pages from a certain parent always can be shown, by making use of wp_list_pages(). Code: function wpse125273_child_page_nav() { global $post; $args = … Read more

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