QUICK TIP - WordPress tricks – The most useful tricks you should know

0 1,236,174
:7of8
1
2
3
4
5
6
7
8
Most Useful .htaccess Tricks for WordPress | A&H Business Technology
Related posts

First, you need to create your maintenance page. This can be as simple or as advanced as you would like. At minimum, you could include something like this into a file named “maintenance.html”:

Then, add this bit of voodoo to your site’s root htaccess file:

Once that’s in place, replace the example IP address with that of your own. Upload to your site and check it out. What you will see is that you have full access to your site, but all other visitors will see the maintenance page.

Once maintenance is complete, simply comment out the code in your htaccess file to allow visitors back into the site.

Source: WP-Mix.com

Display the First Image from Each of Your Posts 

If your posts include an image that you would like to display as a thumbnail elsewhere on your blog, here is an easy way to do it with no custom fields required. Place the following code into your theme’s functions.php file:

Then, to call the function and display the images as thumbnails, place the following code into the desired location within your loop:

That’s all there is to it. If you would like to display a default image for posts that may not have one, specify its path in the code (on the line that says “default image).

Display Most Popular Posts without a Plugin 

Simple but effective method of displaying your blog’s most popular posts based on comment count. This code snippet may be placed anywhere within your theme’s files (i.e., no loop required). Check it out:

Once in place, this code will display the seven most popular posts along with their associated comment count in unordered list format. Customize according to your needs.

Automatically Highlight Search Terms 

Make things easy for people who are searching your site by applying some custom styling to the search terms that are displayed in the search results. A common way to display search terms is with a yellow background so that users can easily identify locations of the text that may apply to their query. It’s all about about usability, and improving the way search results are displayed on your site. Here’s how to do it:

First, replace the the_title() tag in your search.php file with the following:

This will setup styling for search terms located in the title of each result. Then, for the content, replace the the_excerpt() tag in your search.php file with the following:

Finally, open your theme’s CSS file and add some custom styles for the search terms. A great way to highlight each term is to display it in bold text with yellow highlighting. Something like this:

That’s all there is to it! Go run a few searches to see it in action.

TinyURL for this post: https://tinyurl.com/y3vlpp3o

Sorry, The Comment Form Is Temporarily Closed At This Time
:7of8
1
2
3
4
5
6
7
8
7
Next
You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Language:English