Prepend regular Posts with custom slug, without affecting Custom Post Types?

Use the register_post_type_args filter to alter post types registered by code you don’t control. You can set it for a specific type: add_filter( ‘register_post_type_args’, ‘wpd_change_post_type_args’, 10, 2 ); function wpd_change_post_type_args( $args, $post_type ){ if( ‘turnips’ == $post_type ){ $args[‘rewrite’][‘with_front’] = false; } return $args; } Or remove that $post_type check to change it for all … Read more

Get Content From Blog Page

You are using get_the_content() wrong, it can’t take a ID, which is what get_option(‘page_for_posts’) does return, and generally gets the content of the current post inside the loop, in which it has to be used. To get the actual content of that page you can do: $page_for_posts_id = get_option( ‘page_for_posts’ ); $page_for_posts_obj = get_post( $page_for_posts_id … Read more

How to embed page content in a blog post

Create a shortcode to embed the content. This will always be synchronized. Sample code from an older project. Just updated. 🙂 GitHub: https://gist.github.com/3380118 · This post in German (auf Deutsch) on my blog. <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Embed Post Shortcode * Description: Embed any page, post or custom … Read more

What is archive.php used for?

index.php and archive.php might be the same but don’t have to be the same. index.php will display your blog post archive and in the absence of archive.php (or other more specific archive files) it will display your date, author, etc. archives as well. But it doesn’t have to. You can, if you want, display your … Read more