Category Archives: Wordpress

How to setup AMP in WordPress

In this article I’ll show you that how to apply AMP in WordPress sites. It’s simple for a non-technical person. But if you are a Developer/Designer then this should be more easy to you.

Google is very strictly for page speed. Google wants that every websites should be super fast on DESKTOP and on MOBILE devices. And for this Google launched AMP (Accelerated Mobile Pages)

What is AMP?

AMP is an open source framework developed by Google in collaboration with Twitter. Accelerated Mobile Pages create better, faster experiences on the mobile web.

How to install AMP in WordPress?

There are many AMP plugins are available to install on a WordPress site. But there are only few that are works fine.
And after researching on these plugins I found that “AMP for WP – Accelerated Mobile Pages” is the best AMP plugin available on WordPress plugins directory.

Installing AMP in WordPress

This plugin has lots of advance features. In this you will get FREE themes and you can customize theme according to your website’s look and feel.

Apart from this you can get “Add-ons” which you can use for installing or integrating other third party tools or applications. You need to pay for these “Add-ons”.

AMP plugin features

You can download the AMP plugin form here.

How to Force Redirect HTTP to HTTPS in WordPress

This is the easiest way to redirect all HTTP URL’s to HTTPS.
Try this code. Just add it in .htaccess file at the root of your WordPress application.


   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php/$1 [L]
   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Custom fields option isn’t showing – WordPress

If you aren’t able to see custom field options in the backed of WordPress. So you need to click on the checkbox in “Screen Options”.

See the below screenshots as described above.

How to enable custom field options in the backend

After clicking on the checkbox you can see the custom field options in the backed of WordPress below the content editor.

Here is the screenshot for more information.

How to enable custom field options in the backend

How to Limit the Number of Archive Months Displayed in WordPress

If you want to display the number of archive months in WordPress then you just need to add the below function in functions.php file of your current active theme.

After adding the below function in functions.php use the shortcode in WordPress text editor or text widget. This will display archives list with limited months which you will set in the below function.


// Function to get archives list with limited months
function wpb_limit_archives() { 
 
$my_archives = wp_get_archives(array(
    'type'=>'monthly', 
    'limit'=>12,
    'echo'=>0
));
     
return $my_archives; 
 
} 
 
// Create a shortcode
add_shortcode('w3m_custom_archives', 'w3m_limit_archives'); 
 
// Enable shortcode execution in text widget
add_filter('widget_text', 'do_shortcode');