Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name : Simple Seo Plugin
- Author : Arnob Protim Roy
- Detail : SImple Seo is a meta tag plugin
- */
- if(!is_admin()){ // if it is not admin panel
- if(is_single()){ // if it is a single / content page than use content to short description
- $description = get_the_post($_GET['p'],'content');
- if(strlen($description)<160){
- $short_description= $description ;
- }else{
- $short_description = the_excerpt($description,160);
- }
- }else{ // add the site description
- $short_description = get_the_option('site_description');
- }
- //strip all html tag from $short_description
- $short_description = strip_tags($short_description);
- // seo meta description tag tag
- $tag = "<meta name='description' content='$short_description'>";
- // add that to header
- add_header($tag);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement