{myadvertisements[zone_1]}
lagosmp's Forum Info
lagosmp
Junior Member
**
Registration Date: 10-07-2018
Date of Birth: 06-07-1995 (26 years old)
Local Time: 06-22-2021 at 05:02 PM


10-07-2018
12-27-2020, 02:03 PM
17 (0.02 posts per day | 0.8 percent of total posts)
6 (0.01 threads per day | 1.21 percent of total threads)
8 Hours, 40 Minutes, 11 Seconds
Download Submissions: 0 (View Submissions | Download History) Naira: 26.45₦
0
Total Thanks Received: 3 (0 per day | 2.5 percent of total 120)
(Find All Threads Thanked ForFind All Posts Thanked For) Total Thanks Given: 0 (0 per day | 0 percent of total 120)
0 [Details]
Referred by: No-one
Naira: 26.45₦
Given: 0 | Recieved: 3
Additional Info About lagosmp
Jackson
Dammy
Male
Nigeria
Lagos
lagosmp's buddies
lagosmp doesn't have add any buddy.

lagosmp's Most Thanked Post
Post Subject Post Date/Time Numbers of Thanks
Auto Generate Meta Description Without Plugins In Wordpress 02-05-2019, 11:36 PM 1
Thread Subject Forum Name
TIPS Auto Generate Meta Description Without Plugins In Wordpress Webmaster
SEO Tips and Tutorials
Post Message
Meta description is an important factor for Search Engine Optimization (SEO). Search engines use it for display snippet in the search results. Via meta description, visitors can see a brief and concise summary of your page’s content. In WordPress, if you use SEO plugins like All-In-One SEO, it already has the built-in feature for auto generation meta description tag. But you can do it yourself without any plugins, and here it is!

The idea of generating meta description is getting the first paragraph of your post and remove all formats, truncate it to a appropriated length so search engines can understand and display it correctly.

To do that, simply paste the following code into your functions.php file of your theme:

Code:
add_action( 'wp_head', 'prefix_meta_desc' );
function prefix_meta_desc() {
    if ( ! is_singular() )
        return;

    $meta = strip_tags( get_post()->post_content );
    $meta = str_replace( array( "\\n", "\\r", "\\t" ), ' ', $meta);
    $meta = substr( $meta, 0, 155 );

    echo "<meta name='description' content='$meta'>";
}

The code above will run only in singular pages (pages, single posts and all single custom post types). It removes all HTML tags from the post content, replaces all special whitespace characters (tabs, new lines) to a single space and truncates it to 155 characters.

Be sure that you added wp_head() in your theme header.php file.

Why should meta description have 155 characters?
According to the study SEO, the appropriate length of meta description is around 155 characters. The search engines don’t recommend an exact number because it depends on which language of your website and the length of the words.

Meta descriptions can be any length, but search engines generally truncate snippets longer than 160 characters. It is best to keep meta descriptions between 150 and 160 characters.

Now you can forget the SEO plugins and makes your theme optimized for SEO. If you find anything interesting about SEO or meta description tag, please let me know in the comments.

lagosmp's Received and Given Thanks
  Thanks received Thanks given
Last week 0 0
Last month 0 0
Last 3 months 0 0
Last 6 months 0 0
Last 12 months 1 0
All Time 3 0
 
Most thanked by
Kingsolomon 1 33%
Ojochenemi 1 33%
Aniexcels 1 33%
 
Most thanked
Sorry, lagosmp has not yet thanked.

{myadvertisements[zone_2]}