Hi guys, I have a slight problem on my blog site which uses a magazine style theme, the problem is that on the home page everything is displayed as an excerpt, the excerpt being created by a function called "limit post" within the themes functions.php. (see below) # Limit Post function the_content_limit($max_char, $more_link_text = '', $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, '<h1>,<h2>,<strong>,<em>, '); if (strlen($_GET['p']) > 0) { echo ""; PHP: Ok now the content limit varies on different areas of the home page & is set in other code sheets that relate to those areas, however it is always starting the count from zero, which means it includes everything from the begining of the article, upto the set limit, which also means that the H3 title is also being counted and returned as part of the content limit. Ideally I would like to make the count start from after the </h3> and not have the H3 title returned as part of the content limit or excerpt, or put more basically I want it to totally ignore the H3 content. This only effects the displaying of excerpt on the home page & would not come into play when viewing the full article. I'd be very gratefull if anyone could give me some idea how to acheive this as my knowledge of PHP is very basic at the moment. Thanks Steve
No idea of what are you saying. But try this: function the_content_limit($max_char, $more_link_text = '', $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = preg_replace('/^<h3>(.+?)<\/h3>/i', '', $content); // Removes the <h3> element from the beginning of $content $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $content = strip_tags($content, '<h1>,<h2>,<strong>,<em>, '); if (strlen($_GET['p']) > 0) { echo ""; PHP:
Well Zeh, Considering you didn't have a clue what I was talking about, you hit the nail on the head & sorted my problem Thanks a bunch it is exactly what I was looking for. Regards Steve