here’s another thread which may help you with this – http://ww.wp.xz.cn/support/topic/plugin-events-manager-limiting-text-for-event-manager-without-using?replies=19
I have visited it, but I am not good in coding and I don’t understand how I can use it with #_EVENTSNOTES. Could you help me and explain ? 🙂 I don’t want to damage anything.
Thanks in advance
my way of thinking:
#_MYEXCERPT':
$replace = $this->post_content;
if($result == "#_MYEXCERPT"){
$length = 25;
$replace = implode(' ',array_slice(explode(' ', $replace),0,$length));
$replace = $replace.' ...';
}
break;
use as in style.css ?? :
#_EVENTSNOTES':
$replace = $this->post_content;
if($result == "#_EVENTSNOTES"){
$length = 300;
$replace = implode(' ',array_slice(explode(' ', $replace),0,$length));
$replace = $replace.' ...';
}
break;
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
You should be able to use the last example on that thread, replacing 120 with the number of words you want as a limit.
@caimin_nwl you mean this code without changing #_CUSTOMEXCERPT and #_EVENTEXCERPT ?? could you just indicate which file should i modify?
//create the filter. the website will search for our placeholder using this function
add_filter('em_event_output_placeholder','my_em_styles_placeholders',1,3);
function my_em_styles_placeholders($replace, $EM_Event, $result){
global $wp_query, $wp_rewrite;
switch( $result ){
case '#_CUSTOMEXCERPT': // name of the placeholder
$replace = $EM_Event->output("#_EVENTEXCERPT"); //lets retrieve the original event data so we can modify it
$replace = preg_replace('/<[^>]+./','', $replace); // make the modification of taking out any images
if($result == "#_CUSTOMEXCERPT"){ //heres what we are goign to do if the placeholder has been found
if ( strlen($replace) > 120 ) {
$length = 120; //length of word for (the excerpt)
$replace = substr($replace,0,$length); //apply the length amount to the output
}
$replace = $replace . '... ';
}
break; // end the case
}
return $replace ; //output the placeholder
}
@angelo_nwl
I am sorry but it seems too difficult for me.
I have pasted:
function my_em_mod_excerpt_placeholders($replace, $EM_Event, $result){
if ( $result == '#_EVENTEXCERPT' ) {
$replace = preg_replace('/<img[^>]+./','', $replace);
if ( str_word_count($replace) > 300 ) {
$length = 300;
$replace = implode(' ',array_slice(explode(' ', $replace),0,$length));
$replace = $replace . '... ';
}
}
return $replace;
}
add_filter('em_event_output_placeholder','my_em_mod_excerpt_placeholders',1,3);
}
to my functions.php with <?php .. ?> and second time without but my page was broken after that.
Is there any possibility that you could explain me it step by step ? Please 🙂
Hiya,
It looks like you have an extra, unnecessary bracket “}” at the end… you should remove that.
If it still doesn’t work, using pastebin.com to paste the entire contents of your functions.php so we can check it.
Thanks
hmm, you might need to ask for a developer assistance for this to work since we can’t help you for the coding am afraid.
ok, thank you for your time 🙂