Tag Info

Hot answers tagged


You would rather want to use the post ID inside the loop to target your pages. is_page() simply checks whether the current page is actually a page or a specific page if a value is passed Example if ( $post->ID === 7 ) { // Do something for page id 7 } else { // Do something for other pages }


You can approach this by first using a database query to count the number of pages that are already using the template: $query = "SELECT COUNT(*) as total FROM prefix_posts as p JOIN prefix_postmeta as m ON p.ID = m.post_id WHERE p.'post_type' = 'page' AND p.'post_status' = 'publish' AND m.'meta_key' = '_wp_page_template' AND ...


I needed to do something very similar for one of the plugins that I was developing. I registered two separate cpt's during plugin activation, and each of those cpt's should use a custom single template that I had bundled with the plugin code base. You should be able to do the same for page templates, using the page_template filter. Here is my function ...


You're looking for: _wp_link_page( $page_number ); Must be used inside loop, and it return the opening tag: http://wpseek.com/function/_wp_link_page/


The template for the page is called page.php and should be in the same theme folder as index.php (alternatively you can use the is_page() function to do a template inside index.php but it's more difficult and there's little point to that). Best way forward is to study an existing theme and figure how things work. A look at the template hierarchy should help ...

Only top voted, non community-wiki answers of a minimum length are eligible