WordPress.org

Forums

Export to Text
A little modification on both Tags and Categories loop (2 posts)

  1. Sergio Jardim
    Member
    Posted 2 years ago #

    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/

  2. hypedtext
    Member
    Plugin Author

    Posted 2 years ago #

    Wow! Thanks, will try and integrate this soon.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Export to Text
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.