Replace WordPress layout by CVP 3.9.9 and before

This post will help you to replace WordPress layout in Blog, Category, Search… page by Content Views Pro 3.9.9 and before.

For newer version, please check this document.

This is the list of theme files:

# Common themes

  • category.php : Category page
  • tag.php : Tag page
  • author.php : Author page
  • taxonomy.php : Custom taxonomy page
  • archive.php : All above pages
  • home.php : Blog page
  • search.php : Search result page
  • index.php : Any above pages, if its template is not found

# Special themes (for example: Genesis, X)

These themes require special solution to replacing layout. Please check Section II to know how to do.

Pre-requisite: Create child theme

We need to modify theme files. But these modifications will be overridden in next theme update. That is why we should create a child theme to:

  • inherit all features of parent theme
  • free to update parent theme without losing our modifications

Please check this document about creating child theme.

I. Define Layout

Which layout do you want to use for blog, category… page?
You can define this layout by:

  • create a new View, then configure settings in Display Settings tab
  • use layout of existed View (so you have to do nothing in this step)

II. Modify Theme Files

Please open child theme folder to start.

Step 1. Find relevant file (in files list) to edit. There are 2 possible cases:

A. You found the file
Before while ( have_posts() ) paste this code:

if ( method_exists( 'PT_CV_Functions_Pro', 'view_overwrite_tpl' ) ) :
	echo PT_CV_Functions_Pro::view_overwrite_tpl( 'VIEW_ID' );
else :

B. No file found
Please open file index.php. Before while ( have_posts() ) paste this code:

if ( ( (!is_front_page() && is_home()) || is_category() || is_tag() || is_tax() || is_search()) && method_exists( 'PT_CV_Functions_Pro', 'view_overwrite_tpl' ) ) :
	echo PT_CV_Functions_Pro::view_overwrite_tpl( 'VIEW_ID' );
else :

Step 2. On same file as above, after endwhile; paste this code:


Please paste this code to end of file functions.php:

Theme X allows us to modify output of any page by overriding its view file _index.php.
What we should do are:
1. create a file _index.php in this folder /wp-content/themes/x-child/framework/views/global (x-child is folder of your child theme)

2. copy then paste below code to that file

III. Notes

You must replace VIEW_ID in above code by real ID of View.

In common themes, after editing you should have similar code like this:

All added code must be surrounded by PHP tags




In 3.8 and prior versions, when replacing layout of pages, you couldn’t use Pagination settings of View. But it has been available since version 3.9.0, you can set how many posts per page, enable/disable pagination.
To do it, please replace this line

echo PT_CV_Functions_Pro::view_overwrite_tpl( 'VIEW_ID' );


echo PT_CV_Functions_Pro::view_overwrite_tpl( array( 'id' => 'VIEW_ID', 'rebuild' => true ) );

Best regards,