itsumishi
Forum Replies Created
-
Forum: Plugins
In reply to: Email Newsletter PluginsThanks a bunch.
Forum: Plugins
In reply to: Hiding a Div from an ExcerptAs I said.
I’m sure there is a more elegant and flexible solution but this has served it’s purpose for myself.I don’t upgrade as a matter of course anyway. If the page is working and serving it’s purpose why upgrade unnecessarily. Of course if new features come about that I feel are worth upgrading for then I will, I will also add the 21 characters of code back into this page to fix things.
Forum: Plugins
In reply to: Hiding a Div from an ExcerptHi everyone
After a lot of fiddling around today I’ve worked out a solution that’s worked for me. It might need a bit of customising if anyone else wants to use it depending on how they format the posts.
Firstly I’ve opened the wp-includes/formatting.php file and found the following snippet of code.
* @param string $text The exerpt. If set to empty an excerpt is generated. * @return string The excerpt. */ function wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $excerpt_length = apply_filters('excerpt_length', 55); $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); } } return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); }
Apparently you can copy this piece of code and paste it into your theme’s ‘functions.php’ file but I couldn’t get this to work (I think because I have my excerpts on a seperate page that is not directly linked to my wordpress blog and therefore probably skips the themes.
I ended up changing the code in the original formatting.php file.
I simply added
$text = strip_tags($text, '<div>, <ul>, <li>');
Then on my style sheet I added display:none; to the divs (and the ul and li) items that I wanted hidden. I found this has made my excerpts look a lit tidier.
I’m sure there is a more elegant and flexible solution but this has served it’s purpose for myself.
Forum: Plugins
In reply to: Hiding a Div from an ExcerptAnyone have any ideas?