• Resolvido naldinhos

    (@naldinhos)


    Fatal error: Cannot redeclare limit_words() (previously declared in C:\wamp\www\Marketing\wp-content\themes\marketing\functions.php:16) in C:\wamp\www\Marketing\wp-content\themes\marketing\functions.php on line 10

    P/Q esta dando esa notificação e a função não funciona ?

    header.php
    <?php include (TEMPLATEPATH . '/functions.php'); ?>

    functions.php

    <?php
    function limit_words($text, $limit = 25)
    {
    	$words = split(" ",$text);
    	$str = "";
    	for ($i = 0; ($i < count($words) && $i < $limit ); $i++)
    	{
    		$str .= $words[$i] . " ";
    	}
    	return $str;
    }
    
    ?>

    index.php

    <?php
    echo limit_words(get_the_content(), 10);
    ?>
Visualizando 1 resposta (de um total de 1)
Visualizando 1 resposta (de um total de 1)
  • O tópico ‘Função limit_words causa erro fatal’ está fechado para novas respostas.