Show page title just from the first child-page in template

Use WP_Query class to do it: $the_query = new WP_Query( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ) ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <h2 class=”subpagetitle”> <a href=”https://wordpress.stackexchange.com/questions/55118/<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title(); ?>”> <?php the_title(); ?> </a> </h2> <?php endwhile; // Reset Post Data wp_reset_postdata();

Register a title automatically with a relationship field

If you can grab your data early enough you can do this: function alter_title($t) { return ‘altered-title’; } add_filter(‘pre_post_title’,’alter_title’); add_filter(‘pre_post_name’,’alter_title’); That will change the title and the slug before the post is saved. Of course, you need to work out some logic for that function. As is, it changes all post/page/CPT names and slugs on … Read more

Custom Post Title as search term

If you register the post type with public set to true, the titles will be included automatically. You shouldn’t have to do anything to make this happen. Something as simple as this from the Codex: function codex_custom_init() { $args = array( ‘public’ => true, ‘label’ => ‘Books’ ); register_post_type( ‘book’, $args ); } add_action( ‘init’, … Read more

Is it possible to have different header style blog titles in different categories?

I assume that any post belongs to only one category. Create respective CSS classes, e.g. ‘news-header’ and ‘mindset-header’, and use following code inside the loop: <?php // get post categories $categories = get_the_category(); // get single category $category = $categories[0]; // echo header with category class echo ‘<h2 class=”‘ . $category . ‘-header”>’ . get_the_title() … Read more

How to delete posts which have same title?

The easy way is to look at the URLs of the posts (or the IDs) and determine what ones you’d like to delete. Then go to the all posts page and hover over the title of the post you’d like to delete, then click the red trash button.