Exclude child pages args array

There is not depth parameter for get_posts. See http://codex.wordpress.org/Template_Tags/get_posts You will need to check to see whether the page has a parent and display it if it does not have a parent. Once you are in the foreach loop add an if statement <?php if( !$post->parent ): ?> <li><a href=”https://wordpress.stackexchange.com/questions/26866/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> … Read more

$page = get_page_by_title CONTAINS

You should build a query using the WordPress database class. Place this in your functions.php file function get_page_by_title_search($string){ global $wpdb; $title = esc_sql($string); if(!$title) return; $page = $wpdb->get_results(” SELECT * FROM $wpdb->posts WHERE post_title LIKE ‘%$title%’ AND post_type=”page” AND post_status=”publish” LIMIT 1 “); return $page; } Use this in your theme: $page = get_page_by_title_search(‘Foo Bar’); … Read more

Static Website No Titles But Still Nav

Somewhere in your page.php template will be a tag containing the_title(), and that’s what you have to delete. In my WordPress theme, for example, the code looks like this: <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class=”entry”> <div <?php post_class(); ?>> <div class=”post-meta”> <h1><?php the_title(); ?></h1> … Read more

Modifying .page-content background image

WordPress does not have such an option by default; you will have to create the functionality for per-post background images – which is entirely possible. Your best bet might be to use post custom meta to link/upload per-post background images, and then enqueue a dynamic stylesheet that applies that image as the background for the … Read more

Check if page has subpages

You have to pass the parent page id to the wp_list_pages function instead of the global $post->ID in your subpages. function wpse33151_getSubpages() { global $post; $parents = get_post_ancestors($post->post_id); krsort($parents); $parents = array_merge(array(), $parents); if (is_home() || is_single()) { $id = get_option(‘page_for_posts’); $parent = get_post_ancestors($id); $id = $parent[0]; } elseif($parents) { $id = $parents[0]; } else … Read more

How do i pick the pages in 20-11 header?

Twenty Eleven uses wp_nav_menu() and supports one Primary Menu. If you haven’t defined one, it falls back to wp_page_menu(), which displays all pages. You can create your own custom menu in the admin area under Appearance > Menus. Select that menu to be the Primary Menu in the upper left Theme Locations box and you’re … Read more

Archive limit the text of the_content

I’m assuming ‘Archive Page’ is a custom template and not either of the WP archive pages (category/date/author/tag/taxonomy). Try using this: <?php add_filter(‘the_content’, ‘trim_content’); function trim_content($content) { if(is_archive()) { //use your own trick to get the first 50 words. I’m getting the first 100 characters just to show an example. $content = (strlen($content) <= 100)? $content … Read more