Showing the Content of the ‘Posts Page’ before all Posts

If you have set a static front page, and defined a ‘posts page’, WordPress will use the index template to show the list of posts.
This also means that any content you might have entereed into the ‘posts page’ will not get shown.

Make sure to add any content before you set the page as the ‘posts page’; otherwise the editor will not be shown, and a warning message will be displayed instead.

To show this content of the ‘posts page’ before the list of posts, you can use following code (to be inserted into functions.php of a child theme, the html structure of the example below is based on Twenty Fourteen):

function page_content_on_posts_page() {
if( get_option( 'page_for_posts' ) && is_home() ) {
global $wp_query;
if( !is_paged() && $wp_query->current_post == 0 ) { ?>
<article id="post-<?php echo get_option( 'page_for_posts' ); ?>" class="<?php echo implode(  ', ', get_post_class( 'posts-page-content', get_option( 'page_for_posts' ) ) ); ?>">

<div class="entry-content">
echo apply_filters( 'the_content', get_post( get_option( 'page_for_posts' ) )->post_content );
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php }

add_action( 'the_post', 'page_content_on_posts_page' );



Injecting Multiple adsense Ads into a WordPress Loop

The versatile code injects for instance adsense ad codes several times into the posts of an index or archive page, starting with a pre-set post, and then repeated in regular intervals (up to a set limit of ads per page).

For example, in a child theme of Twenty Fourteen, this code would be added into content.php at a suitable location:

//set the variables//
$nth = 3; //1,2,3,,4...; repeated every n-th post
$snr = 1; //1,2,3...; pre-set start with post nr
$limit = 3; //adsene TOS limit of ads per web page

$lsnr = $snr - 1; // correct for loop counter start at zero

if( $wp_query->current_post >= $lsnr && ( $wp_query->current_post - $lsnr )%$nth == 0 && (int)(( $wp_query->current_post - $lsnr ) / $nth ) < $limit ) { ?>
<?php } ?>

The example values would start the add in the first post, and repeated every three posts for a maximum of 3 ads.

A Real ‘Full Width Page’ Template for Twenty Fourteen

To create a real full width page – with no sidebars whatsoever – in your WordPress site while using a child theme of the default theme Twenty Fourteen, program this page template file with the file name real-full-width.php (important as this is referenced in the CSS) and save it in a sub-folder /page-templates in the child theme:

 * Template Name: Real Full Width Page
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0

get_header(); ?>

<div id="main-content" class="main-content">

	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
		// Include the featured content template.
		get_template_part( 'featured-content' );

	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">
				// Start the Loop.
				while ( have_posts() ) : the_post();

					// Include the page content template.
					get_template_part( 'content', 'page' );

					// If comments are open or we have at least one comment, load up the comment template.
					if ( comments_open() || get_comments_number() ) {
		</div><!-- #content -->
	</div><!-- #primary -->
</div><!-- #main-content -->


Add this section to style.css of the child theme:

.page-template-page-templatesreal-full-width-php .site {
	width: 100%;

.page-template-page-templatesreal-full-width-php  .hentry {
	margin: 0 auto 48px;
	max-width: 90%;

.page-template-page-templatesreal-full-width-php .site-content .entry-header,
.page-template-page-templatesreal-full-width-php .site-content .entry-content,
.page-template-page-templatesreal-full-width-php .site-content .entry-summary,
.page-template-page-templatesreal-full-width-php .site-content .entry-meta,
.page-template-page-templatesreal-full-width-php .page-content {
	margin: 0 auto;
	max-width: 90%;

.page-template-page-templatesreal-full-width-php .main-content,
.page-template-page-templatesreal-full-width-php .content-area {
	float: left;
	width: 100%;
.page-template-page-templatesreal-full-width-php .site-content,
.page-template-page-templatesreal-full-width-php .site-main .widecolumn {
	margin-left: 0;

.page-template-page-templatesreal-full-width-php .site:before {
	width: 0;

.page-template-page-templatesreal-full-width-php .site-content {
	margin-left: 0;
	margin-right: 0;

(not optimized)

Activate the template in the ‘Edit Page’ dashboard page, under ‘Page Attributes’ by ticking ‘Real Full Width Page’.