How to remove a page in its entirety
How to remove a page in its entirety
How to remove a page in its entirety
In the case of a plugin template, you might find the slug is more reliable for a condition – see below for alternate approach. When using is_page_template() the parameter passed is anypath/filename.php. Without knowing your file system specifics or the name of the plugin, it is impossible to give you the correct relative path for … Read more
URL redirect to home page issue in word press site
Page and admin doesnt load – i tried everything
Use the body_class filter to change the <body> CSS classes. You can copy the same logic into your hooked function (like below), or make it neater by copying the logic into another new function and make this function return a boolean (and then use that new function with the body_class filter and within your template_redirect … Read more
I assume you’re using wp_insert_post() to create the private page for the user. The function returns the ID of the created page. You can use this ID as part of a custom capability you grant to the user. // create the new $user // create private page $private_page_id = wp_insert_post( $postarr, $wp_error = false ); … Read more
how to change permalink for dynamic page without 404 error
You can use get_page_by_path() to get a Page’s WP_Post object using its slug (ie, its path), and then use that object to then get the array of child page IDs using get_children(). // First we’ll create the list of posts (pages) to exclude. $exclude = array(); $parent_page_obj = get_page_by_path( ‘abc’ ); if ( ! empty( … Read more
Add this to you theme, just after the title part that displays the title. <?php $args = array( ‘post_type’ => ‘page’, // Only get pages (attachments can be listed as children) ‘posts_per_page’ => -1, // List all the children ‘post_parent’ => $post->ID // Get pages that are the children of the current page ); $parent … Read more
You can get the parent with wp_get_post_parent_id(get_the_ID()), and store it in a new variable and do the same with the children and then just showcase them in any format you want. <?php $theParent = wp_get_post_parent_id(get_the_ID()); if ( $theParent->ID == 83 ) { ?> <div class=”parent”><?PHP echo get_the_title($theParent); ?></div> <ul class=”children”><?PHP wp_list_pages(array( ‘title_li’ => ”, ‘child_of’ … Read more