Speed up WordPress with free Cloudflare CDN

Speed of website loading has become one of the crucial parameter for user experience and search ranking also. There can be several ways to speed up WordPress by either introducing high cost dedicated server/ VPS servers or using some alternate methods for low cost solution.

My focus is to present low cost solution to users as WordPress is mostly used by personal bloggers who don’t want to spend for high end solutions. Larger number of WordPress installations are on shared hosting platform which have certain reservations due to sharing of resources like server bandwidth, RAM etc. So our purpose is to overcome these limitations and speed up WordPress.

First, we are aware about the use of CDN for improving loading speed of website. Let us see basics of CDN operation. In general, each webpage has html/text file which contains the links for associated resources like CSS file, JS files, images etc. So whenever any request goes to server then it first fetch its html file and then other resources are also collected. The html file is dynamically generated by WordPress installation. If you are using some cache plugin or performance plugin like W3 Total cache then those plugins cache html and other things for each page. Caching of pages help to reduce load on Server. Whenever any page request is there, then WordPress will check availability of cached html otherwise it will dynamically generate html for the request.

The other static resources which are linked in html page are then collected by browser for creating a complete webpage. The html content has to be generated/delivered by server where WordPress installation exists but static resources can be delivered by other servers also. This is the main objective for using CDN. If you change the links of static resources in main html file then those links will point to other server. In case of CDN, the linking url of those static resources points towards CDN server. This helps us in reducing load on primary server. Out of total resources for webpage, only few files are transferred from primary server, rest are delivered from CDN servers.

CDN servers has lot more technology to deliver your content /static resources from your nearest location with fastest speed. So the delay created by primary server for delivering each static resource is removed by use of CDN.

Now we just assume that our static resources are delivered by CDN with best performance. But in spite of this there are components which introduce delay in loading webpage. We know that static resources are delivered by CDN but html page is still supplied by primary servers. Downloading of Static resources start after this html is downloaded by browser. So the delay in loading this html file affects overall response of webpage critically. In shared hosting environment, the server connection time, wait time, receive time etc is significant. You may see cases where this html file transfer itself takes more than a second.

Next, our objective is to reduce transfer time for this html file. If we deliver html file also from CDN server then we can improve the overall response of webpage loading. As we discussed above about caching of pages so that WordPress need not generate each page dynamically for each request. These cached pages reside in primary server. If this cached html is delivered from CDN server instead of primary server then our purpose of loading everything from CDN will be fulfilled.

There is some problem with this system. We just want that our articles and other static pages get delivered totally by CDN. There are certain areas which should deliver dynamic content every time like login page and all backend administration area etc. So we need to cache html for certain pages and bypass caching of html for backend and login pages.

Speed up WordPress with Cloudflare

  • Add your site for Cloudflare CDN
  • Create page rules for Cache Everything with Cloudflare

Add your site for cloudflare CDN

There are lot of help materials for setting up Cloudflare CDN for your site. You can also refer earlier article How to setup Cloudflare CDN for WordPress.

Create page rules for Cache Everything with Cloudflare

One of the important thing to know that generally CDN cache only static resources like js,css and image files. Cloudflare also do the same. If you want to cache html resource also then you need to create page rule. Cloudflare has feature to create multiple page rule for caching of content. Free Cloudflare account allows only three page rule. But WordPress users can optimally utilize these three page rules to delivery of all content from Cloudflare CDN and speed up WordPress site.

After you add your site in Cloudflare, then go to pagerule section and create these three page rules. Create them in the same sequence as mentioned as priority of rules depends in the order they are recorded.

Cloudflare pagerule to speed up wordpress

With pagerule specific CDN settings for particular url pattern can be created. Here we have three url pattern which can solve our purpose of html cache of pages except admin areas. The asterisk * before and after in url pattern allow any pre and post url pattern segment.

  • The first pattern is to bypass cache for wp login page. You can also add something like *yourprimarydomain/wp-login* . In case of findurlaptop, wordpress installation is inside tech folder so all url have findurlaptop.com/tech pattern. If your primary domain directly points to WordPress installation then you can have url pattern like *yourprimarydomain/wp-login* otherwise you can also do like findurlaptop installation.
  • Second pattern is to bypass cache for admin area
  • Third pattern is to allow everything in your WordPress installation.

There are number of settings in each page rule but first and the most important is custom caching. First two pagerules bypass cache and third pagerule allows to cache everything.

So this way you can achieve serving of complete WordPress page from Cloudflare CDN. This will significantly speed up WordPress.

How to Create Local Web Server with XAMPP for WordPress

If you like to install WordPress on local computer or want to create a local server environment for web development and testing, then you need to create local server in your PC. There are several ways to create local server but we are primarily concerned with server environment for WordPress, we will see the local Web Server with XAMPP.

XAMPP logo

WordPress is coded with PHP and database is created in MySQL so WordPress prerequisite is PHP and MySQL. The current version of WordPress 4.3 requires following.

  • PHP version 5.6 or greater
  • MySQL version 5.5 or greater

Local Server can be created in Windows machine or Linux machine or Mac.

  • If you want to create Web Server environment in Windows machine with Windows environment, then IIS service need to be activated. After activation of IIS service, PHP and MySQL need to be installed separately and some changes in IIS configuration for activation of PHP script is to be done.
  • If you want to create Web server in Linux machine, Apache server can be installed and then PHP and MySQL need to be installed. Some changes in server scrip for activation of PHP script is required.

Both the above process are not straight and requires certain settings in system before finally achieving Web Server environment. So developing machine as Web Server by installing each application separately and configuring Server for scrip activation is not a straight process which seems tedious for common user. Common user target of learning WordPress and WordPress development becomes more difficult.

XAMPP which is a composite package of Web Server application, PHP and other necessary application can be installed by a single click. This package can be downloaded from XAMPP site and installed in Windows, Linux or Mac system.

Latest version of XAMPP 5.5.28 for Windows contains

Apache 2.4.16

MySQL 5.6.26

PHP 5.5.28

phpMyAdmin 4.4.14

FileZilla FTP Server 0.9.41

Tomcat 7.0.56 (with mod_proxy_ajp as connector)

Strawberry Perl 7.0.56 Portable

XAMPP Control Panel 3.2.1

It is clear from above list that XAMPP package contains Apache for creating Web Server. PHP script and MySQL database are part of this package. phpMyAdmin is the front end application for MySQL database management. So download XAMPP from the link and install the package in your PC. XAMPP is installed in the default Windows directory “c:\xampp\”. Once the application is installed, go to XAMPP control Panel (Icon is created at desktop) and start the Apache and MySQL service.

XAMPP Control Panel

Now your machine is ready as Web Server and Web development work. Now open your browser and write “http://localhost/” in address bar. You will see the default XAMPP files are loaded into browser. Users must know that Apache has default “htdocs” folder for web directory. So any website or page must be within “htdocs” folder for accessing through browser. (Default settings).

Test Web Server Environment with XAMPP

Just for testing the Web Server, create a html and php file and put that file in htdocs folder for access through browser. “C:\xampp\htdocs\” is the default address of folder.

Open a text file through notepad and write <h1> Test File</h1> and save it as test.html. Similarly Write <?php echo “My first PHP script!”;?> on notepad file and save it as test.php file. Put both these files into “C:\xampp\htdocs\” folder. “C:\xampp\htdocs\” acts as localhost for Web Server. You can otherwise download some html and php file from internet and place them in local web directory (htdocs folder) for accessing through browser. [If file extension .html and .php is not visible in notepad file, then go to folder option and uncheck the option in view tab Hide extensions for known file types. This will start showing the file extensions. File name like test.html.txt will not be rendered by browser. It should be test.html ]

Now write “http://localhost/test.html” in browser address bar and see that your file is loaded in browser. Result – Test File

Now write “http://localhost/test.php” in browser address bar and see that your php file is also rendered and loaded in browser. Result – My first PHP script!

If both the files are loaded successfully then it means that your Web Server has started loading php and html script properly. So you can proceed with WordPress installation.

Posts from selected category on home page of WordPress blog

WordPress has option to display post archive on home page or display a specific page. Post archive include posts from all the categories so there is no choice to display posts from selected category on home page or discard posts from specific category.

In this article my objective is to display posts from selected category on home page of WordPress blog. Before doing any specific coding, let’s see how WordPress home page is generated.

Posts from selected category on home page of WordPress blog

How content on home page is generated

WordPress has standard loop function which shows posts from all categories. The loop functions looks like this.

Here while statement creates loop. The have_posts() and the_post() are standard WordPress functions. It is important to know that before landing on this home page template, the WordPress core has already created the main database query so all the posts are fetched from database as per main query.

How to display posts from selected category on home page of WordPress blog

Lets see the methods to show posts from selected category on home page of WordPress blog. There are several articles on internet which suggest query_posts() function for displaying posts from selected category on home page of WordPress blog. This is old method to display posts from selected categories. You may better use pre_get_posts hook to display post from selected category on home page.

  • Avoid query_posts() function to show posts from selected categories on home page of WordPress blog

In this method, you need to create a database query to fetch posts from selected categories. WordPress already creates a main query before this function executes for modified query so the new database query adds further load on database. The main query which display posts on WordPress is replaced by query generated by query_posts() function.

  • Use pre_get_posts to show posts from selected category on home page of WordPress blog

Pre_get_posts is a hook which is called after database query variable object is created. $query object is passed to our function by reference so it does not require declaration of Global variables. Using pre_get_posts to show posts from selected categories on home page of WordPress blog is very easy. As we know that pre_get_posts hooks our function at a point when database query variable is created but main query is not been run so we can modify query at the initial point itself.

  1. Create a function to modify query
  2. Hook this function through pre_get_posts

Look at the function to implement this. Copy this function and paste it in functions.php file of your child theme.

Understanding this function is very easy. In our selected_category() function, we applied if statement to ascertain home page and main query. So our function will change main query for home page only. $query object variable will set query parameters. There are large number of possibilities to set parameters differently but our objective is to get specific categories on home page so we focus on different ways of setting query for category selection.

$query->set( ‘cat’, ‘7,15’ );

The parameters required for set function is query_var and its value i.e set( $query_var, $value ). We want to raise query based on category so our query variable will be category. Look at the various types used as query variable for selection of a category.

cat (int) – use category id.

category_name (string) – use category slug (NOT name).

category__and (array) – use category id.

category__in (array) – use category id.

category__not_in (array) – use category id.

 

Example

  • If you want to select category based on category id then you can set query parameters like $query->set( ‘cat’, ‘1,3,5,9’ ). Here category with id 1,3,5 and 9 will be selected.
  • If you want to deselect some particular category then you can use negative number like $query->set( ‘cat’, ‘-1,-7’ ). Here category 1 and 7 is deselected and query result will show all categories except 1 and 7.

As we did for selection through cat parameter, same can be done for selection through category_name parameters also.

How to know category ID in WordPress

When we create a new category in WordPress, we just provide the name & slug for category so category id is not visible directly in admin interface. It is stored in WordPress database. There is one simple way to know category ID. You go to category page on WordPress dashboard and mouse over the name of category link. The footer section of WordPress dashboard shows a url which has category id.

know category ID in WordPress

 

To summarize, You just need to copy the selected_category() function and add_action in your functions.php file. Modify the category ID number or name as per your requirement.

Footer navigation menu in Twenty Fifteen WordPress Theme

There is provision of only one primary navigation menu in Twenty Fifteen. The second navigation menu is just for social links.Earlier I wrote about static Top header menu in Twenty Fifteen. Some Theme users require footer navigation menu in Twenty Fifteen so code for creating footer navigation menu is given here. This footer menu is a single level navigation menu where all the menu items are placed in horizontal bar.

The code for Footer navigation menu in Twenty Fifteen is divided into three parts.

  1. Register navigation menu in functions.php
  2. Display navigation menu at appropriate location of footer section
  3. CSS style for footer navigation menu in Twenty Fifteen

You are advised to copy the code for these three sections and paste it into corresponding files of your Twenty Fifteen child theme. Let’s see the details.

Footer navigation menu in Twenty Fifteen

Register navigation menu in functions.php

This is a standard way of creating navigation menu in WordPress. You need to register navigation menu in functions.php. Copy the below given code in functions.php file of Twenty Fifteen child theme.

Display navigation menu at appropriate location of footer section

The navigation menu which you registered in functions.php can be displayed at any location where this below mentioned code is inserted. Our intention is to display this navigation menu in footer section therefore we will place this code in footer.php at the beginning of file. Copy this code and paste it just after the <footer> HTML tag in footer.php file.

As you can see in the above code that the depth of this navigation menu is -1, here -1 displays links at any depth and arranges them in a single flat list.

CSS style for footer navigation menu in Twenty Fifteen

CSS styling is essential part for displaying the navigation menu properly. Copy these CSS styles in style.css file of your Twenty Fifteen child theme.

Hope you would have created Footer navigation menu in Twenty Fifteen successfully. You may change colors , if required.

How to use CloudFlare cache everything feature for WordPress

Generally CDNs deliver static web content like CSS files, JS file, images etc. HTML files are delivered directly from the web server so when you want to deliver everything from CDN then HTML should also be delivered from CDN server. In this condition, CDN servers cache all content of your webpage, this means everything is cached on CDN server and delivered directly to user.

You may refer previous articles on CloudFlare account setup for WordPress. CloudFlare is one of the leading CDN which provides completely free account with most of the essential features.

The standard methods of caching levels in CloudFlare are Basic, Simplified and Aggressive but HTML cache can’t be achieved with these so you need to create page rules. You may read previous article for HTML cache & page rules and steps for creating page rules.

page rules in cloudflare

What are the problems when you cache everything of a webpage

When you cache everything of a webpage then each file is cached in CDN server and there is no delivery of content from primary webserver till cached content is available in CDN. There is no problem in delivering the front end pages of website through CDN as they are meant for general public but there is problem with backend pages. Generally backend of website is meant for website administration which involves general administration, article publishing, website parameter settings etc. All these administrative actions involves backend login, saving data in database, changing database entries so you need to connect directly with web server instead of loading pages from CDN server.

When you cache everything (including backend pages) then you may not be able to login into WordPress backend interface and perform administrative action.

How to use CloudFlare cache everything  for WordPress

You must read previous articles for understanding use of page rules. Best way to use cache everything feature is to isolate front end and backend delivery urls. You may see example of findurlaptop. If I cache everything of primary domain url then it will include backend login urls also. Lets see this example.

  • If primary domain url of WordPress site is www.example.com
  • Then WordPress admin login page url will be www.example.com/wp-login.php
  • The login page redirects to backend admin area after successful login. The backend admin url will be www.example.com/wp-admin/

When you cache everything of primary domain by giving url *example.com* then it includes both the login page url and back-end administration url also. So this allows CDN to cache login and backend admin url which prohibit administrators for backend login and administration. To avoid this situation, we should bypass caching for login url and backend admin url.

There is option to bypass cache in page rules of CloudFlare. So you bypass cache for both these urls

  • www.example.com/wp-login.php
  • www.example.com/wp-admin/

There is one more thing to remember. The order of page rules is very important. If you cache everything of a website in your first page rule then lower order page rules will not be able to bypass certain urls. Priority of page rules is from top to bottom. First page rule comes first and then lower page rules decide for action.

In order to achieve cache everything in WordPress with successful login and administration, you can order page rule in this way.

*example.com/wp-login.php*

Bypass Cache

*example.com/wp-admin/*

Bypass Cache

*example.com/*

Cache Everything

This will allow administrators to login into backend interface and perform administrative action. These pages will be served directly from Web server. All the other pages will be served by CloudFlare CDN.

How to Install WordPress in your Local Computer

Internet users are familiar with the term Websites. Earlier website were built with individual pages, later different content management systems emerged which helped building websites or blogs easily. Some of the prominent names among open source CMS are WordPress, Joomla and Drupal. These open source CMS are freely available so users can download and create site/blog based on these CMS. All these CMS have their own architecture which gives them some advantage/disadvantage over the others. WordPress is most common name among bloggers. This open source CMS is highly user friendly and it has large support for development and additional features.

Wordpress XAMPP MySQL logo

Users who are interested in learning WordPress may install WordPress in their local machine and test the functioning of this most amazing content management system. WordPress installation in local machine is just 15 minute process which is very simple and trouble free. Look at the sequential step of WordPress installation in local machine.

  • WordPress is coded into PHP and it requires MySQL database.
  • PHP is server side script so users need to create a local server in machine.

So prerequisite for WordPress is Server with PHP and MySQL. In our previous article we mentioned about creating local web server with XAMPP. XAMPP creates Apache web server and install PHP and MySQL also. So after XAMPP installation, machine is ready to install WordPress.

  • Download latest version of WordPress from website. This is zipped file so unzip the files in separate folder. [WordPress download Link]

Step by step procedure for creating local installation of WordPress.

  1. One database is required for WordPress site. So create a database in some name. If you are using XAMPP local server, then go the control panel of XAMPP. You must ensure that Apache and MySQL services are started for web server. Click on the admin button of MySQL on XAMPP control panel, this will take you to http://localhost/phpmyadmin/. Here you can create a database with the help of phpmyadmin, the database manager for MySQL. Here you access the database as root user and no password is given for database access. Now click on the database tab in the main window of phpmyadmin and you will see a input space for creating database. Just type the name of database and click on control button Create. On left hand column you will see that the new database is created. This database user is root and no password is set for database access.
  2. Now copy the unzipped folder of WordPress into htdocs directory of XAMPP. For example C:\xampp\htdocs\wordpress\. Here WordPress is the folder which is having all the files of WordPress CMS.install WordPress
  3. Now open your browser and type http://localhost/wordpress/ . This will open your WordPress installation file. Type the name of the database which you created through phpmyadmin panel. In case of XAMPP, user name is root and password is left blank. Database host is localhost for local computer. WordPress creates number of tables in database and tables has specific Table Prefix like wp_ or ab_ or cd_ or else. As a safety measure, you should chose something other than standard suggested name wp_.  After you Submit this information, WordPress installation files checks for database requirements, connectivity etc. If everything is ok , wp-config.php file is automatically created in WordPress folder and it ask to Run the Install . Click on Run the Install button.
  4. Now WordPress installer ask you certain website details like Site title, Username , password and email.Enter these basic details and click on Install WordPress. This completes the WordPress installation. final-wordpress-installation-page

You already know the admin user name and password so you can login into WordPress dashboard for website administration.

  • Type http://localhost/wordpress/ to see the website.
  • For admin login, go to http://localhost/wordpress/wp-admin/. Here you enter user name and password as set earlier while WordPress installation. You will enter into admin area of WordPress where you can create article, change settings and completely manage the site.

Top Header menu in Twenty Fifteen WordPress theme

WordPress Twenty Fifteen theme has two menu options. First is Primary navigation menu and another is Social Links Menu. The location of Primary navigation menu is in sidebar for screen larger than 954 pixels. For smaller screens, it is inside the header and accessible through toggle button.

Top Header menu in Twenty Fifteen WordPress

If you like to create a horizontal Top Header menu in Twenty Fifteen which is at the top of webpage, then you need to register another navigation menu and place the navigation navbar html code at appropriate location of webpage. Look at the steps for creating Top Header menu in Twenty Fifteen WordPress theme.

  1. Register Top Header navigation menu in functions.php file
  2. Place the html code for navigation menu in header.php
  3. Create CSS style for Top Header menu in Twenty Fifteen

You make all these changes in child theme only as a standard practice. Creating a child theme is easy so don’t avoid, first create a child theme and then proceed for other things.

Register Top Header navigation menu in functions.php file

WordPress has option to register for theme features like post format, navigation menu, sidebars etc. Theme designers can register for these theme features and call support for those features in WordPress theme. You can also register this Top Header navigation menu in functions.php .So copy this code into functions.php file of your Twenty Fifteen child theme.

Place the html code for Top Header navigation menu in header.php

We want to place this navigation menu at the top of header so place this code in the header.php file. The code shown below creates a navigation menu so copy this code and place it before the <div id=”sidebar” class=”sidebar”> tag.

Place the above code before <div id=”sidebar” class=”sidebar”> tag in header.php file of Twenty Fifteen child theme.

After the registration of navigation menu, it is visible in admin panel so you can assign any menu to this Top Header menu.

Create CSS style for Top Header menu in Twenty Fifteen

After you register navigation menu in functions.php file and add html code in header.php file, particular menu will be visible in webpage. But due to absence of proper styling of navigation menu, menu items are not displayed properly.

Copy these CSS style properties and paste them in style.css file of your child theme.

If you want to change the color of menu item, navbar etc , you can do that by changing corresponding HEX color code.

How to create Right Sidebar in Twenty Fifteen

WordPress Twenty Fifteen default layout has only one sidebar which is placed on left side. This sidebar has header title, description, navigation menu and widget area. This sidebar appear for screen width of 955px and more. Below 955 pixels, it converts into top header where title and description are only visible, rest of the items of this sidebar confine into a toggle button.

If you want to shift this left sidebar to right sidebar in Twenty Fifteen and maintain rest of the behaviour of this sidebar as it is, then you need to modify few CSS properties of Twenty Fifteen. If you like to understand the behaviour of this sidebar, you need to look into the basic structure of Twenty Fifteen. There are four elements which broadly structure the webpage.

  • Body
  • Sidebar
  • Site content
  • Site footer

Right Sidebar in Twenty Fifteen

Look at the default behaviour of these elements for width of 955 pixels and more.

Body – The background of sidebar is created by body:before CSS property. For smaller screen, this background becomes header background. In case of width more than 954 px, body:before creates background of sidebar. This is positioned as Fix and aligned left.

Sidebar– Normally this div element is left aligned. This sidebar has right margin of -100% which pulls other div elements. Sidebar has width of 29.4118%.

Site content– This div element has width of 70.5882% and left margin of 29.4118%. This div element overlaps with sidebar. It is also left aligned so it settles on the right side of sidebar.

Site footer – This div element has width of 58.8235% and left margin of 29.4118%. This div element overlaps with sidebar. It is also left aligned so it also settles on the right side of sidebar.

For creating right sidebar in Twenty Fifteen, first we move sidebar background to right side of webpage. Then we shift sidebar content also on the right side of webpage and align site content & site footer to left side of webpage. So the overall CSS style for right sidebar in Twenty Fifteen is shown below. This CSS style will be applied for screen larger than 954px i.e min-width: 59.6875em .

You just copy this code in style.css of your Twenty Fifteen child theme. We highly recommend to make changes in child theme only. Read previous article for child theme creation.

This setup maintain behaviour of right sidebar in Twenty Fifteen same as default sidebar in left side.

How to use website logo in Twenty Fifteen WordPress theme

You may refer previous article on features of twenty fifteen theme for having basic idea of this theme. You can also check for default layout of twenty fifteen theme in previous article.

There is no option to display website logo in Twenty Fifteen theme. There is option to upload header image but this image occupies complete area of header or sidebar. If you want to display website logo in Twenty Fifteen then you need to make little changes in header.php file.

logo in Twenty Fifteen WordPress Theme

You are advised to make changes in the child theme. You may refer previous article on WordPress child theme for creating a child theme.

Actions for displaying website logo in Twenty Fifteen

  1. Upload website logo
  2. Make changes in header.php file for displaying logo

Upload website logo – For using logo in Twenty Fifteen theme, you need to upload your website logo and get the URL of logo image. Login into admin panel and upload your logo file through the Media->Add New. Now you can copy the URL of this logo which will be required as a parameter in our code.

Make changes in header.php file for displaying logo – Open header.php file. Look for the html div element for site branding. The code looks like this.

In the above block of code , paste this image element code just after the <div class=”site-branding”> div element.

<a href=”<?php echo esc_url( home_url( ‘/’ ) ); ?>” rel=”home”><img src=”http://localhost/word/wp-content/uploads/2014/12/logo.gif” alt=”website logo”></a>

This image element will show the website logo in Twenty Fifteen. In the source property of this image tag ‘src’ , provide the URL of your website logo.

Now logo of your website is displayed on top. Remember to deselect website header and description from the customization option otherwise both logo and title will be displayed simultaneously.

How to use post excerpt in Twenty Fifteen WordPress theme

With new theme layout, Neat & clean content area, great readability settings and other features Twenty Fifteen is going to be favorite of many bloggers. Most of the blog users expect post excerpts on front page. The Twenty Fifteen shows full article on front page, category page, search page etc . There are number of articles on front page, category page, archive pages, search page etc so the length of webpage becomes huge and webpage size also increases. This can be avoided by showing post excerpt in Twenty Fifteen.

Post excerpt in twenty fifteen

Just look at the basic files of Twenty Fifteen theme which generate template and fetch content for webpage.

  • Pages where multiple post results are displayed like Front page, archives, category page, search page etc – The first file which creates template is index.php. This file uses content.php or other content file according to post format,search etc for generating post content.
  • Page where single post result is displayed – All the single post are created by single.php file. This file creates basic template and calls content.php or other content file according to post format for generating post content.

So it is clear that post content is generated by content.php file or other content file for both the cases. These content files are commonly used. There are five files for generating content result.

  1. Content.php
  2. Content-link.php
  3. Content-none.php
  4. Content-page.php
  5. Content-search.php

Content-none.php is used when there is no post to display. Similarly content-search.php is used for getting content for search result. In most of the cases like archive, category etc , content.php file is used for generating post content.

Post excerpt in Twenty Fifteen

Look at the default code inside the content.php which need to be modified for post excerpt in Twenty Fifteen.

 Now you can see from the block of code shown above that full content of each post is displayed through the the_content() function. If we change this block of code to show full content for single post and post excerpt for all other cases, then purpose will be solved. Look at basic logical function for achieving this.

As I told , full post content is shown by function the_content() and post excerpt is shown by the_excerpt() function. Therefore you just need little more similar code. Look at the modified code for post excerpt in Twenty Fifteen.

If you want to change length of post excerpt in twenty fifteen, then you may use this function in your functions.php file.

 The function the_excerpt() shows continue reading link at the end of post excerpt.If you want to modify continue reading link with Read more , you can use this function in your functions.php file.