Showing posts with label Website Tips. Show all posts
Showing posts with label Website Tips. Show all posts

Tuesday, June 4, 2019

How to disable, limit and delete WordPress post revisions?

how-to-disable-limit-delete-wordpress-post-revisions

If you are familiar with WordPress CMS, you might have observed that WordPress autsaves every edit by default. Post revisions is a good feature in WordPress to review and track changes. However, for some it may not be necessary as it is not required or due to database size concerns.

In this post, we shall see how to disable WordPress post revisions, set WordPress post revision to a certain number, deleted previous WordPress post revisions. 

So, I have a WordPress website too and I saw that the revision of a particular post is 229 already! I am not sure if there is a limit in WordPress up to how many latest revisions are saved. I guess there is none by default. It would be awesome if there is a setting for admins to set the revisions in WordPress.

wordpress-post-revisions-1


Anyway, I decided I do not need that many post revisions in my database. I also do not want to disable post revisions completely. You may want to completely disable revisions as per your need. Follow the steps below as per you need.

1) Disable WordPress post revisions
As discussed WordPress keeps post revisions by default. There is no UI to disable it. However, it can be defined in wp-config.php file.

Add the following line of code at the bottom of the wp-config.php file just above (require_once( ABSPATH . 'wp-settings.php' );) to disable WordPRess post revisions.

define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false ); 

Place the code above the line: require_once( ABSPATH . 'wp-settings.php' ); 

This code will disable all future revisions to be saved and it will also increase the autosave interval from 60 seconds to 300 seconds. The post will be auto-saving every 5 minute instead of every minute.

2) Set WordPress post revision to a certain number
In my case, I did not disable the post revisions. I wanted to reduce the number of post revisions to keep.  To limit the number of WordPress post revisions, add the following line of code at the bottom of the wp-config.php file.

/** No. of revisions to keep */
define( 'WP_POST_REVISIONS', 2 );
Place the code above the line: require_once( ABSPATH . 'wp-settings.php' );

This will keep only two post revisions in the database.

3) Delete previous WordPress post revisions

As discussed above, we can disable and limit the post revisions. However, doing the above changes does not remove the previous post revisions already saved in the database, which are occupying unnecessary space.

To delete the previous post revisions from WordPress database, do the following:
  • Login to your host Control Panel
  • Launch phpMyAdmin
See the post revisions in WordPress database:

Launch phpMyAdmin > Click on SQL tab and run the query:

SELECT ID,post_title,post_type FROM `wp_posts` where post_type="revision";

Note: If table prefix (wp) has been changed, use appropriate table prefix in your case.

This query will show you all the posts which are of type - post revisions.

wordpress-post-revisions-phymyadmin





Find out how many post revisions are there in the WordPress database:

Launch phpMyAdmin > Click on SQL tab and run the query:

SELECT count(*) FROM `wp_posts` where post_type="revision";

Note: If table prefix (wp) has been changed, use appropriate table prefix in your case.

This query will display the number of post revisions in the database.

Delete the post revisions from database:

To delete the post revisions, run the following query from phpMyAdmin:

DELETE FROM wp_posts WHERE post_type = "revision";

Note: If table prefix (wp) has been changed, use appropriate table prefix in your case.

The steps in this post should disable Post revisions, set a limit to the number of post revisions to keep and delete all previously saved post revisions stored in the WordPress database.

Post revisions may be a useful feature but if it is not necessary for you, you may following the steps above to disable or limit the post revisions as discussed.


Saturday, April 27, 2019

WordPress: How to display only limited number of most popular tags in WordPress Tag Cloud and keep same font size?

wordpress-tag-cloud

In WordPress, there is a widget called "Tag Cloud" which displays the Tags used in posts. This is useful when we want to display a list of Tags in widget areas so that visitors can quickly find related posts by Tag. In this post, we shall see -
  • How to limit the number of most popular tags to display in the Tag Cloud widget?
  • How to keep the same font size of the Tags in the display?
Read more »

Saturday, September 29, 2018

Solution for: Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

cookies-blocked-not-supported-browser-enable-to-use-wordpress

On some clients' website built using WordPress, there was this error:
Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

If you also have a WordPress website where you are seeing the error "Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress" when attempting to login, please find the solution below.
Read more »

Tuesday, May 1, 2018

How to add custom ads.txt to Blogger / WordPress / Other websites?


how-to-add-custom-ads-txt-blogger-wordpress-website

What is Ads.txt ?


Authorized Digital Sellers, or ads.txt is an IAB initiative that helps ensure that the digital ad inventory is only sold through sellers you identify as authorized. Creating your own ads.txt file gives you more control over who is allowed to sell ads on your website and helps prevent counterfeit inventory from being presented to advertisers. An ads.txt file can help buyers identify genuine inventory and help publisher receive more advertiser spend that otherwise might have gone toward counterfeit inventory.

In this post we shall see "How to add ads.txt to Blogger / WordPress / Other websites?"..


Read more »

Monday, April 9, 2018

How to stop spam subscribers on WordPress email subscribe form?

wordpress-stop-spam-subscribers

Email subscription forms are very essential for any website to let visitors subscribe to new contents. Email subscription forms will also let website owners collect emails which can be used for online marketing. However, mail subscribe forms may also attract a lot of spam subscribers. In this post, we shall see how to stop spam subscribers on WordPress email subscribe form using free plugins.

Before we discuss how to stop spam subscribers, let's discuss briefly how to include a Subscribe Form in WordPress.
Read more »

Friday, November 24, 2017

Useful WordPress PLugin to resolve HTTPS insecure content and mixed content warnings on WordPress

wordpress-plugin-insecure-mixed-content-errors

Nowadays, most recent browsers expect websites to have HTTPS in the URL, meaning SSL certificate installed on server, which makes websites which used to be accessible over simple, insecure HTTP protocol to more secured HTTPS. In one of the previous post -I posted about "How to fix partially encrypted/mixed content errors after switching from HTTP to HTTPs (SSL)". In this post, we shall discuss particularly on "How to resolve HTTPS insecure content and mixed content warnings on WordPress Websites?"
Read more »

Sunday, November 19, 2017

Remove or modify Copyright From WordPress Free Theme's Child Theme Footer


Remove or modify Copyright or credit links from WordPress Theme's Child Theme Footer? The title seems a little confusing, but what I mean is if you want to remove or modify the copyright link in the footer of a child theme whose parent theme is a WordPress Theme wherein the creators allow editing or removing the credit links. Phew! Well, I specifically mentioned "allow to remove the credits" because, "free theme" doesn't mean we can always freely remove credits from themes wherever we want. And since it is the work of others, it is recommended to credit the creators though I know many people remove the credits just like that. 

Anyway, in this post we shall discuss how to remove or modify the copyright credit link from the footer of a child theme of a WordPress theme, which allows removing the credit links.
Read more »

Monday, October 30, 2017

Drupal 8 Tips: Display only one image from multifield image on teaser

drupal8_display_one_image_multi_image_upload_views

On Drupal 8, there is a useful feature in Views Module (now in Core) settings called "Multiple field settings" with which we can  display only one image from multifield image on teaser. As seen in the image above, each of the content has multiple images but only one is displayed in the teasers.
Read more »

Tuesday, August 1, 2017

How to access a website that shows "Your connection is not secure"?


When I browse a website I see "Your connection is not secure". What to do?
If you are trying to access a website served on HTTP then most probably you would see "Your connection is not secure" or "Your connection is not private". In some cases, the reason for the error could be due to the following reasons.

Browsers today indicate whether a website is secure or not by the following icons on the left of the address bar:
  • Lock Secure
  • Info Info or Not secure
  • Dangerous Not secure or Dangerous

Reasons for "Your connection is not private " error could be due to:
  •     Wrong date and time (User's end)
  •     Antivirus block SSL Connection (User's end)
  •     Invalid Browser Cache and Cookies files (User's end)
  •     SSL not implemented (Website owner's end)
  •     Expired SSL certificate (Website Owner's end)
  •     Invalid SSL Certificate Setup (Website Owner's end)
Solutions for "Your connection is not secure" or "Your connection is not private" due to the above errors:

    Wrong Date & Time:  (User's end)
If computer or device's date & time is incorrect, the browser is unable to verify the SSL certificate. Check your system date and time and correct it. Then try again.
   
    Antivirus Blocked SSL Connection:  (User's End)
Besides wrong date & time, antivirus software may be blocking SSL connections. Disable the antivirus and try again. If it works with antivirus blocked, then you need to check your antivirus settings to allow SSL connections.
   
    Invalid Browser's Cookies & Cached Files: (User's End)
Invalid Cache and cookies can also cause this error. Try clearing cookies and cached files in the browser and then try again.
   
    Expired SSL Certificates: (Website owner's end)
In some cases, the owner of the website might have applied SSL but the certificate expired. In that case, the website link may have HTTPS in the URL but there will be a red mark in the URL. In this case, the user cannot do anything about it. A user may notify the website owner if there is a way to. As a user, if you need to access the website and the website is trusted, then you can proceed to access the website by:

  • On Firefox browsers: click Advanced and add Exception. 
  • On Chrome browsers: click "Proceed to www.websitename" 
    Invalid SSL Certificate Setup: (Website owner's end)
In some cases, the "Your connection is not secure" or "Your connection is not private" error could be due to invalid setup of SSL certificate. As a user there is nothing you can do from your end.A user may notify the website owner if there is a way to. As a user, if you need to access the website and the website is trusted, then you can proceed to access the website by:
  • On Firefox browsers: click Advanced and add Exception. 
  • On Chrome browsers: click "Proceed to www.websitename" 


How to access a website that shows "Your connection is not secure"?

The "Your connection is not secure" or "Your connection is not private" error could be due to any of the reasons discussed above or something else. Users may check if the error is occuring from their end such as incorrect system date and time etc. But if the issue is from the website owner's end, there is nothing a user can do. 

 If you trust the website (well, not the connection), and you have to access it, then you can go ahead by following the steps below in Firefox browser:
  • On the page where "Your connection is not secure" message is displayed, click on "Advanced"
  • Now click on Add Exception.
  • Click on Confirm Security Exception
  • If you want, you can view more information regarding the problematic certificate by clicking the View button.
Similarly in Chrome, you can click on "Proceed to www.website..." to continue accessing the website.

There are some detailed steps to check more when you see "Your connection is not secure" here.

Monday, June 5, 2017

How to add a responsive slider on OSCLASS website (using contributed OSCLASS Slider plugin)?

How to add a responsive slider on OSCLASS website

Sliders or Slideshows are dynamic elements usually displayed in home page of websites. Usually with a catchy background image and phrases, they grab attention. They are great additions to any websites to add more aesthetics to websites. Since they are dynamic, websites look more grand and alive. They can also be used to display important content and graphics to engage with visitors. And though sliders are not so good in terms of making websites easily accessible on mobiles over data network due to higher load times, it has still become a standard web design layout. 
Read more »

Saturday, June 3, 2017

How to download a website from live server to development local server?

download-move-website-from-live-server-to-local-development-server

In this post, we shall see how to download a website from live server to development local computer. I will be using a Drupal website as an example. On the local machine, I am running XAMPP stack on Windows. But the process would generally be the same for any other CMS or website for that matter. If you are looking for how to move or upload a website from local development computer to a live production server, following the steps here.

Read more »

Thursday, June 1, 2017

How to move website from XAMPP on one computer to XAMPP on another computer?

How to website from XAMPP on one computer to XAMPP on another computer?

I normally use XAMPP for web development on my local Windows machine. And I needed to move the website files from one computer to another as I have a new Windows laptop on which I would be doing my web development activities from now on. So, I needed to move the existing website files from the older computer to the new computer, along with the database of the website. If you are in a similar situation, refer to the steps below how to move the websites from XAMPP on one computer to XAMPP on another computer.


XAMPP is a free and open source cross-platform web server solution stack package developed by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB database (supports MySQL) , and interpreters for scripts written in the PHP and Perl programming languages.

    X = Cross Platform / Any Operating System
    A = Apache Web Server
    M = MySQL / Maria DB
    P = PHP Programming Language
    P = Perl Programming Language

XAMPP is easy to install and packages all the above requirements of web development out of the box. There is minimal configuration required to kick start web development on local machine instead of installing all the above requirements manually.


How to move websites from XAMPP on one computer to XAMPP on another computer?


Assumptions / Pre-Requisites:

So, I have been using XAMPP for web development on my local computer. I use WordPress and Drupal mostly, but there are some custom PHP sites too. In this post, I will be using one of the WordPress CMS site for the purpose of illustration in this post. On my system, XAMPP is installed at C drive at C:/xampp. Thus, website files are located under C:\xampp\htdocs directory.


For the steps explained below, it is assumed that XAMPP is installed on both the computers already.


Steps to move websites from XAMPP on one computer to XAMPP on another computer.

This method is not only for WordPress shown in this example. It can be used for any other CMS or sites. The basic process in a nutshell is to move the website folder to the new computer under the same folder, that is under C:\xampp\htdocs and move the database to the new computer


1) Move website files from computer 1 to computer 2:

    Copy the website folder you want to move from C:\xampp\htdocs\. For this example, the website folder to be copied is "techblog". Thus, I copied the folder C:\xampp\htdocs\techblog
    Move the website folder from the computer 1 to C:\xampp\htdocs\ on the computer 2 using any medium. For this example, the website folder copied is "techblog". So, we should have the website files in C:\xampp\htdocs\techblog.

That is all that is required as far as moving the website files from one computer to another for using with XAMPP is concerned.


2) Export database of the website from computer 1
  •     Open phpMyAdmin in a browser on computer 1 by accessing http://localhost/phpmyadmin
  •     Login to phpMyAdmin if a password is set for root
  •     Select the  database from the left sidebar of phpMyAdmin
  •     Click on STRUCTURE and check how many tables the database has. It is displayed at the bottom of the STRUCTURE page. Compare  the number of tables during import on computer 2.
  •     Now to export, click on EXPORT tab

        Note: For some CMS (such as Drupal, WordPress etc.) it is recommended to clear cache from the admin interface before exporting database to avoid any import issues and/or site issues after import.

  •     Keep default settings and just click "GO" to export and download the database.
  •     An SQL file will be exported. Save it to computer 1
 




 3) Import the exported database from computer 1 into computer 2

  •     On computer 2, access http://localhost/phpMyAdmin and login if a password is set.
  •     Once logged in to phpMyAdmin, click on "databases" and create a new database.
  •     You can name the database whatever you want but preferably keep the same name so that settings need not be changed.
  •     Select the new database from the left sidebar
  •     Click Import.
  •     Click on the "Browse" button and locate the database we exported from the old computer.
  •     Keep default settings and just click "GO" to import the database.
  •     Once the database is installed, check the website on computer 2 by accessing http://localhost/techblog. If the database name was kept the same during new database creation on computer 2, there is no need to change database name in the website settings file.

Database import issues?

Unable to import database into phpMyAdmin due to an error?

If this is a new  XAMPP installation on the new computer without any setting changes so far, then the database might not have uploaded due to size limit. In that case, upload size need to be changed in php.ini file on computer 2.


        Error: No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration

If you are unable to import database into phpMyAdmin due to the above error, you would need to edit some settings in php.ini configuration file at C:\xampp\php\php.ini.


  •     Open php.ini in a notepad, preferably Notepad++ and edit the values of the following parameters. I increased the following parameters to:

        post_max_size = 50M
        upload_max_filesize =50M
        max_execution_time=200
        max_input_time=200

Since it is a development environment, you can set it to any reasonable value. On live server, these parameters will usually be controlled by your web host service provider. and you may not have access to php.ini.

  •     After changing the values of the above parameters, restart Apache from XAMPP control panel.
  •     Retry the import of SQL database into phpMyAdmin. It should be resolved now.


How to prepare the SQL database file before import if the XAMPP on the previous computer was using another port for such as "localhost:8080" instead of the default "localhost"

If on the previous computer 1, XAMPP was set to use "localhost:8080" instead of "localhost" to access web pages but on the new computer it is using the default "localhost" to access web pages, then the website on computer 2 will not work properly as the database has referenced to "http://localhost:port-number/websitename". Sometimes, people have multiple web servers on a single computer such as IIS and Apache from XAMPP. In that case, the default HTTP port 80 may already be used by the other web server. So, Apache is assigned another port to use.


We can edit the URLs containing the "localhost:8080" from phpMyAdmin with simple SQL querries but I find it easier to edit it using text editors by using simpler "find and replace" feature. We can find all reference of "localhost:8080" and replace them with "localhost" only. For this purpose Notepad++ is good instead of Notepad.

  •     Open the databasename.sql exported from the previous XAMPP in a Notepad or Notepad++
  •     Press CTRL+F and search for "localhost:8080". You should be able to see some results.
  •     Now replace all instances of "localhost:8080" with "localhost" by doing replace all.
  •     Save the edited SQL file or "Save As" with a new name
  •     Use this edited SQL file in the phpMyAdmin import (described above).


Other related posts:

    How to install and run XAMPP on Windows?
    How to migrate site from local development machine to live site?
    How to install and run WordPress using XAMPP on Windows?

Popular computers on Amazon

Monday, March 27, 2017

Drupal Tips - How to redirect user to Drupal frontpage after login

Drupal tips how to redirect user to frontpage after login.png

Drupal usually redirects a user after login to the account information page. But if you would like users to redirect to the Drupal Frontpage after login, the this post is just about that. In this Drupal Tips , we shall discuss how to redirect user to Drupal Frontpage after login. 
Read more »

Sunday, January 22, 2017

How to create sliders in Drupal 7 using Views Slideshow?

How to create sliders in Drupal 7 using Views Slideshow

Sliders or Slideshows are dynamic elements usually displayed in home page of websites. Usually with a catchy background image and phrases, they grab attention. They are great additions to any websites to add more aesthetics to websites. Since they are dynamic, websites look more grand and alive. They can also be used to display important content and graphics to engage with visitors. And though sliders are not so good in terms of making websites easily accessible on mobiles over data network due to higher load times, it has still become a standard web design layout.

In this post we shall discuss how to create testimonial sliders in Drupal 7 using Views Slideshow. Though the usual sliders we see are catchy background images with catchy phrases, sliders are not only meant for images. They can be any thing, almost. We can also display text such as testimonials, images, quotes etc.

Read more »

Friday, January 6, 2017

How to make Blogger widgets visible in Blogger Mobile template (also make Adsense visible in mobile template)?


In Blogger, the view on desktop computers and mobile devices are shown differently. By default, the template on mobile devices are stripped down and responsive. Not all sections or widgets displayed on desktop computers are visible on mobile devices. Most widgets manually added to Blogger will not be view-able on mobile devices. Adsense added from Blogger's Adsense widgets are visible however their display regions are only on the top and bottom of the page. Google Adsense code if added manually to the blog using Blogger HTML/JavaScript widget won't display on mobile devices. In order to show widgets visible on desktop to also show on mobile devices, including Google Adsense widgets, do the following changes.

How to enable widgets to display on mobile devices?
Read more »

Sunday, November 20, 2016

How to create or save favicon or icons using Photoshop?

How to create or save favicon or icons using Photoshop
How to create or save favicon or icons using Photoshop? 

Favicon is a small image that is used on websites and are displayed in browser tabs. In this video, we discuss how to create Favicon or icon files using Photoshop. Icons by default have .ICO file extension. By default, Photoshop does not allow creation of icons. To create or save image as icon, we will be using a plug-in in Photoshop.
Read more »

Thursday, November 3, 2016

OSCLASS Tips : How to move OSCLASS website from live server to localhost development server ?


This post is about how to move OSCLASS website from live server to local development server. The process in a nutshell is pretty forward that is, to download the website files and put them in the local website directory, export database from the live server to the local server and update configuration files on development server. But there are some minute updates or changes required to let OSCLASS work on localhost development server, which we will see in brief in this post.
Read more »

Wednesday, October 19, 2016

Free Responsive Mobile Menu Plugin For WordPress

WordPress Plugin for responsive menu
With the increasing use of mobile phones, there is a lot of importance now on responsive web design. In the recent years, there is a lot of emphasis on responsive web design, so that the experience on mobile devices is smooth and user friendly. Keeping that in mind, it is better to have a responsive menu for mobile users instead of the default menu layout even for our WordPress sites. Luckily, there are responsive menu plugins out there for WordPress! There may be a lot out there, but in this post, we'll see one particular WordPress plugin that will enable responsive menu for mobile devices for a WordPress website.

While some WordPress themes takes care of responsive menu in their template design itself, most themes may not. For this example, I am using one of the default WordPress themes - Twenty Eleven. We will see how the WordPress menu looks like on mobile and how the menu is neatly displayed responsively after installing the plugin.
Read more »

Google Search Consile Error - Submitted URL marked ‘noindex’

Sitemaps are important from SEO perspective. If you have installed the WordPress plugin Google XML Sitemaps , and you have submitted a link ...