Advertisement
apr

Plug.php Simple seo plugin of BornoCMS

apr
Jun 3rd, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <?php
  2. /*
  3.     Plugin Name : Simple Seo Plugin
  4.     Author : Arnob Protim Roy
  5.     Detail : SImple Seo is a meta tag plugin
  6. */
  7.  
  8.  
  9. if(!is_admin()){ // if it is not admin panel  
  10.  
  11.     if(is_single()){ // if it is a single / content page than use content to short description
  12.    
  13.         $description = get_the_post($_GET['p'],'content');
  14.        
  15.         if(strlen($description)<160){
  16.             $short_description= $description ;
  17.         }else{
  18.             $short_description  = the_excerpt($description,160);
  19.         }
  20.        
  21.        
  22.        
  23.        
  24.  
  25.     }else{ // add the site description
  26.    
  27.         $short_description = get_the_option('site_description');
  28.        
  29.     }
  30.    
  31.     //strip all html tag from $short_description
  32.     $short_description = strip_tags($short_description);
  33.  
  34.     // seo meta description tag tag
  35.     $tag = "<meta name='description' content='$short_description'>";
  36.      
  37.     // add that to header
  38.     add_header($tag);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement