WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Export to Text] A little modification on both Tags and Categories loop

[Plugin: Export to Text] A little modification on both Tags and Categories loop

  • Hi!
    First of all, thanks for this great plugin! Helped me a lot!

    I’m using it to export posts that will be on a special book and I’ll be using categories and tags to organize the text into sections in the book. 🙂

    I’ve made one little modification on the Tag and Categories foreach on file export-to-text.php so that the comma separator only appears if there is more than one tag ou categorie in the post and also that it doesn’t appear after the last value. I think that is an improvement, but be my guest to say otherwise. 🙂

    The new code are here:

    if(in_array('Categories', $_POST['data_filter'])) {
    			$j=0;
    			foreach ( get_the_category () as $category) {
    				$j++;
    				if($j==1) {
    				 	$ett_post .= $category -> cat_name;
    				} else {
    					$ett_post .= ', ';
    					$ett_post .= $category -> cat_name;
    				}
    			}
    			$ett_post .= "\t";
    		}
    
    		if(in_array('Tags', $_POST['data_filter'])) {
    			if (has_tag()){
    				$i=0;
    				foreach ( get_the_tags () as $tag) {
    				$i++;
    					if($i==1) {
    				 		$ett_post .= $tag -> name;
    					} else {
    						$ett_post .= ', ';
    						$ett_post .= $tag -> name;
    					}
    				}
    			}
    			else {
    				$ett_post .= '';
    			}
    			$ett_post .= "\t";
    		}

    http://wordpress.org/extend/plugins/export-to-text/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Export to Text] A little modification on both Tags and Categories loop’ is closed to new replies.