Create a loop that gets pages with their template

The snippet from codex is a bit redundant in your case. You can achieve what you need, by using snippets like these: index.php $mainpage = get_page_by_title( ‘ROOT’ ); $the_query = new WP_Query( array( ‘post_parent’ => $mainpage->ID, ‘post_type’ => ‘page’, ) ); $index = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<section class=”page’ . get_the_ID() … Read more

Create custom PAGE with register_post_type

Your screenshot seems to indicate that you’re interested in the status message for your custom post type saying ‘Page updated. View page’. If that’s true, the reason that you’re getting ‘Post updated. View post’ is that you haven’t provided status messages for your custom post type. Here’s the code for the admin edit page (edit-form-advanced.php): … Read more

Two Search pages, One search form

Hook into ‘template_include’ and change the template here. Made up example, not tested: add_action( ‘template_include’, ‘wpse_96472_search_template’ ); function wpse_96472_search_template( $template ) { if ( ! is_search() ) return $template; if ( empty ( $_GET[‘post_type’] ) ) return $template; if ( ‘poster’ === $_GET[‘post_type’] ) return get_template_directory() . ‘/poster-search-template.php’; if ( ‘house’ === $_GET[‘post_type’] ) return … Read more

Private Posts/Pages & Search

This is the default WordPress behavior. http://codex.wordpress.org/Content_Visibility#Private_Content Private posts are automatically published but not visible to anyone but those with the appropriate permission levels (Editor or Administrator). WARNING: If your site has multiple editors or administrators, they will be able to see your protected and private posts in the Edit panel. If you want to … Read more

Create ghost page

You can do it this way. check for a unique class for the page in the menu or add an unique class. you can do it by checking CSS classes under screen options in the menu edit page. lets say the class you added is ghost-page Then in the js file jQuery(document).ready(function(){ jQuery(‘.ghost-page’).on(‘click’, function(e){ e.preventDefault(); … Read more

Include content from one page to another

Another shortcode option (add the following to your functions.php). With this one, you have two options. You can query by the post/page ID (will work for any post type), or the page name/slug (only works for pages). // Add “Show Content” Shortcode function wpse_120886_show_content( $atts ) { // Attributes $a = shortcode_atts( array( ‘id’ => … Read more

Hiding Page by Title from Editing

You can hide pages using a filter on pre_get_posts. That can be done setting ‘post__not_in’ argument, but that argument need page ids. And you don’t know the id before the page is created. For that reason, tou can run an additional query to retrieve the ids based on the titles, or better on the slugs … Read more

How to modify the default WordPress ‘Pages’ widget to have titles on the anchor tags?

A fast and short solution would be – function wpse_list_pages( $output ){ $output = preg_replace( ‘/<a(.*?)>(.*?)<\/a>/’, ‘<a$1 title=”$2″>$2</a>’, $output); return $output; } add_filter(‘wp_list_pages’, ‘wpse_list_pages’); And if you want a proper way, you could extend Walker_Page (ref: post-template.php) class and set the Pages Widget walker to class with widget_pages_args hook