Customize the Category Archive Page Title

WordPress allows you to set a ‘category base’ to show in the permalinks of the category archive pages – you can set this under ‘dashboard – settings – permalinks – category base’.

However, the latest default theme Twenty Fifteen is using a function to generate the Category Archive page title – get_the_archive_title() – which simply output ‘Category’ and does not reflect on the ‘category base’ entry.
Luckily, the function applies a filter which we can use to influence the Category Archive page title.

Example of a filter function:

add_filter( 'get_the_archive_title', 'use_category_base_in_archive_title' );
function use_category_base_in_archive_title( $title ) {
    if ( is_category() && get_option('category_base') ) $title = str_replace( 'Category:', ucfirst( get_option('category_base') ) . ':', $title );
    return $title;

As the category base is usually all lowercase letters, the suggested code also capitalizes the first letter when used as Category Archive page title.

Exclude Pages from Default Menu in Twenty Eleven

If you are not using the custom menu, the theme uses `wp_page_menu()` as a fallback.

As always, start by creating a child theme of Twenty Eleven;

To exclude pages from the default menu, edit functions.php in the child theme and add something like:

//exclude pages from default menu//
function twentyelevenchild_page_menu_args( $args ) {
		$args['exclude'] = '17,38';
	return $args;
add_filter( 'wp_page_menu_args', 'twentyelevenchild_page_menu_args' );

The numbers refer to the page IDs of the pages you want to exclude.

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’.