__construct(); } // Get out there and rock and roll the bones: function __construct() { add_action('admin_menu', array($this, 'inserttags_addMenu')); add_action('admin_init', array($this, 'inserttags_page_init')); add_action('save_post', array($this, 'inserttags_convert_content_to_tags')); } // add menu under Settings function inserttags_addMenu() { add_options_page( 'settings insert tags', 'settings insert tags', 'manage_options', 'inserttags', array($this, 'inserttags_option_page') ); } //register Field names: function inserttags_page_init() { register_setting( $option_group = 'inserttags', $option_name = 'inserttags_ignore_words' ); } // Display options page: function inserttags_option_page() { if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'Nu aveti suficiente permisiuni pentru a accesa pagina aceasta!' ) ); } ?>

Setari de baza insert tags

Cuvintele care vor fi ignorate din tagurile postarilor:


Your support can help us in making more free components. Even a single Dollor can count us big.
Click "Donate" button for contributing your part.
Donate
Thanks for your love.
post_content)) : $content = $post->post_content; // Only run if there are not already tags assigned to the post: if(!wp_get_post_tags($post_id)) : // Setup our tag data: $content_to_tags = array(); $wordstoignore = $this->fmzac_getWordsToIgnore(); $content_werdz = explode(' ', $content); foreach ($content_werdz as $werd) : $werd = $this->fmzac_lowerNoPunc($werd); if(!in_array($werd, $wordstoignore) && !in_array($werd, $this->wp_stop)) : $content_to_tags[] = $werd; endif; endforeach; // Finally, add the tags to the post wp_add_post_tags($post_id, $content_to_tags); endif; endif; } //load ignore word function fmzac_IgnoreWords() { $values = get_option('fmzac_ignore_words'); if(strlen($values) < 1) : $values = implode(', ', $this->fmzac_getWordsToIgnore()); endif; echo '

These words will be ignored when generating tags from title (punctuation removed). To reset, simply delete all values here and the default list will be restored.

'; } // Gets the ignore word list: private function fmzac_getWordsToIgnore() { $vals = array(); $file = dirname(__FILE__).'/tags.txt'; $wordstoignore = explode(',', file_get_contents($file)); foreach($wordstoignore as $word) : $vals[] = $this->fmzac_lowerNoPunc($word); endforeach; return $vals; } // Converts all words into lower-case words, sans punctuation or possessives. private function fmzac_lowerNoPunc($werd) { $werd = strtolower(trim(preg_replace('#[^\p{L}\p{N}]+#u', '', $werd))); return $werd; } } ?>