Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Comment créer automatiquement une méta description à partir de votre contenu dans WordPress

<?php
function create_meta_desc() {
    global $post;
if (!is_single()) { return; }
     $meta = strip_tags($post->post_content);
    $meta = strip_shortcodes($post->post_content);
    $meta = str_replace(array("
", "
", "	"), ' ', $meta);
    $meta = substr($meta, 0, 125); 
    echo "<meta name='description' content='$meta' />";
}
add_action('wp_head', 'create_meta_desc');
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php default argument 
Php :: phpmailer 5 string attachment 
Php :: add attribute validation lang laravel 
Php :: upsert request php-salesforce-rest-api 
Php :: Type error: Argument 1 passed to IlluminateDatabaseGrammar::parameterize() 
Php :: WooCommerce quantity field to ajax add to cart button archive page 
Php :: php hide credit card middle numbers 
Php :: way to convert an integer to an array of numbers 
Php :: php header deny 
Php :: Online Food Ordering System Project SQL 
Php :: PHP force refresh image 
Php :: setUp() must be compatible with IlluminateFoundationTestingTestCase::setUp() 
Php :: objeto php em sessão 
Php :: laavel relation through morph 
Php :: passing data from controller to blade view laravel 
Php :: ifmodule condition in htaccess 
Php :: To show inline category 
Php :: hi we add file in orders the other hide and order show in laravel view 
Php :: laravel dompdf barcode 
Php :: open two files at once in phpstrom 
Php :: phpmailer valid cert 
Php :: add attachment to the invoice laravel 
Php :: php The function is a conversion from a key to a value 
Php :: remove public laravel 
Php :: add header image to woocomerce shop page 
Php :: PHPExcel not supporting long integer value 
Php :: call a class in another class php 
Php :: symfony clear session 
Php :: multiple laravel site in one directory 
Php :: get current date epoch php 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =