Hi, I want the posts of the contributors of my blog to have a minimum size. How can I let WordPress check this automatically? I mean, I don´t want the posts to be submitted for review if they don´t exceed the minimum length. Thank you. Javi
Paste the below code into functions.php // Content Limit function content($num, $more_link_text = 'Find out More...') { $theContent = get_the_content($more_link_text); $output = preg_replace('/<img[^>]+./','', $theContent); $limit = $num+1; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content); $content = strip_tags($content, '<p><a><address><a><abbr><acronym><b><big><blockquote><br><caption><cite><class><code><col><del><dd><div><dl><dt><em><font><h1><h2><h3><h4><h5><h6><hr><i><img><ins><kbd><li><ol><p><pre><q><s><span><strike><strong><sub><sup><table><tbody><td><tfoot><tr><tt><ul><var>'); echo close_tags($content); echo "<p><a href='"; the_permalink(); echo "'>".$more_link_text."</a></p>"; } Code (markup): edit the following code to index.php <?php content(50, __('Find out More...')); ?> Code (markup):
Hi dsimi, thanks a lot but I´m not sure that´s what I was looking for. I want the posts of the writers of a blog to be longer than x words. If they are note longer than x then the writer shouldn´t be able to send it to revision. Greetings Javi
I like these kind of questions, so going to theorize on how it can be done. In the post edit screen there is a word count below the textarea of the post. I am thinking that count is stored somewhere. You would have to hook into the Publish action and check for two things, if the poster is a contributor and that the word count is above your limit. If it passes, then it gets sent through to the editor (basically a draft). If if fails, then you send a message to the top of the screen (there is a filter for that). You can pore thru the Codex to find all of the particulars. Or hire someone to actually do it.