I get nothing out of this.
I tried several code snippets provided and can’t get this to work at all.
Hi,
i’m trying to avoid the excerpts and jump direct to the content of the posts and the categories.
I found this nice useful plugin with this instruction:
thisismyurl_get_better_excerpt(‘skipexcerpt=true’);
but, where should i put it?
(WordPress 3.4.2 / Neuropro Template)
Thanks
]]>i added some simple additional arguments to satisfy my need of better controlling the output in regards of tags.
function get_better_excerpt($options='') {
$ns_options = array(
"sentence" => false,
"words" => "20",
"before" => "",
"after" => "",
"show" => false,
"skipexcerpt" => true,
"link" => false,
"trail" => " …",
"allowed" => ''
);
$options = explode("&",$options);
foreach ($options as $option) {
$parts = explode("=",$option);
$options[$parts[0]] = $parts[1];
}
if ($options['sentence']) {$ns_options['sentence'] = $options['sentence'];}
if ($options['words']) {$ns_options['words'] = $options['words'];}
if ($options['before']) {$ns_options['before'] = $options['before'];}
if ($options['after']) {$ns_options['after'] = $options['after'];}
if ($options['show']) {$ns_options['show'] = $options['show'];}
if ($options['skipexcerpt']) {$ns_options['skipexcerpt'] = $options['skipexcerpt'];}
if ($options['link']) {$ns_options['link'] = $options['link'];}
if ($options['allowed']) {$ns_options['allowed'] = $options['allowed'];}
if (isset($options['trail'])) {$ns_options['trail'] = $options['trail'];}
global $more;
$more = 1;
if ($ns_options['skipexcerpt']) {
if ($ns_options['sentence']) {
$excerpt = explode('.', strip_tags(get_the_content(), $ns_options['allowed']), $ns_options['sentence']+1);
} else {
$excerpt = explode(' ', strip_tags(get_the_content(), $ns_options['allowed']), $ns_options['words']+1);
}
} else {
if ($ns_options['sentence']) {
$excerpt = explode('.', strip_tags(get_the_excerpt(), $ns_options['allowed']), $ns_options['sentence']+1);
} else {
$excerpt = explode(' ', strip_tags(get_the_excerpt(), $ns_options['allowed']), $ns_options['words']+1);
}
}
array_pop($excerpt);
$excerpt = implode(" ",$excerpt);
$excerpt = $excerpt.$ns_options['trail'];
if ($link) {
$link = get_permalink();
$title = get_the_title();
$excerpt = "<a href='$link' title='$title'>".$excerpt."</a>";
}
$excerpt = $ns_options['before'].$excerpt.$ns_options['after'];
if ($show) {echo $excerpt;} else {return $excerpt;}
}
]]>
I’ve looked at the source code and you’re using variables $show and $link without even declaring them, intead of $options[‘show’] and $options[‘link’]. After changing that it’s ok.
]]>