Skip to content

Instantly share code, notes, and snippets.

@beyazitkolemen
Created January 16, 2013 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyazitkolemen/4547225 to your computer and use it in GitHub Desktop.
Save beyazitkolemen/4547225 to your computer and use it in GitHub Desktop.
function ozet($max_char, $more_link_text = '(devamı»)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
if (strlen($_GET['p']) > 0) {
echo "";
echo $content;
echo " ";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
echo "";
echo $content;
echo " ";
}
else {
echo "";
echo $content;
echo " ";
}
}
<?php ozet(500)?> ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment