How to make bulk list from Wordpress posts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • druid66
    Confirmed User
    • Feb 2006
    • 994

    #1

    How to make bulk list from Wordpress posts?

    hey trolls,
    got a question: what if i would like to make a list of urls + descriptions with pipe delimiter like the list for TGPX from Wordpress posts so i could easy use it as galleries for TGPX - is it possible, do you know any plugin which can do this?
    Pure Japan japanese babes blog
  • zerovic
    Confirmed User
    • Apr 2010
    • 1116

    #2
    Something like this?

    open an empty file, copy/paste the code and upload to your sites root

    Code:
    <?php
    include('wp-load.php');
    if($_POST['number']) {
    query_posts('showposts=' . $_POST['number']);
    while (have_posts()) : the_post();
    echo the_permalink() . $_POST['separator'] . get_the_content() . "<br />";
    endwhile;
    } else {
    echo "<form method=\"post\">";
    echo "<label>number of posts</label> <input type=\"text\" name=\"number\" /><br />";
    echo "<label>separator</label> <input type=\"text\" name=\"separator\" /><br />";
    echo "<input type=\"submit\" value=\"export\" />";
    echo "</form>";
    }
    ?>
    php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

    Comment

    • zerovic
      Confirmed User
      • Apr 2010
      • 1116

      #3
      here's another version..sorry, the code is a bit messy, but does the job you need

      this will work with links, titles and descriptions.. you set the number of posts, separator and the order you want to display and it will display it to you...

      again, the code is messy as hell, but it works

      Code:
      <?php
      include('wp-load.php');
      if($_POST['number']) {
      query_posts('showposts=' . $_POST['number']);
      while (have_posts()) : the_post();
      
      if($_POST['order_1'] == "url") {
      echo the_permalink();
      }
      if($_POST['order_1'] == "title") {
      echo get_the_title();
      }
      if($_POST['order_1'] == "description") {
      echo get_the_content();
      }
      
      if($_POST['order_1'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
      
      if($_POST['order_2'] == "url") {
      echo the_permalink();
      }
      if($_POST['order_2'] == "title") {
      echo get_the_title();
      }
      if($_POST['order_2'] == "description") {
      echo get_the_content();
      }
      
      if($_POST['order_2'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
      
      if($_POST['order_3'] == "url") {
      echo the_permalink();
      }
      if($_POST['order_3'] == "title") {
      echo get_the_title();
      }
      if($_POST['order_3'] == "description") {
      echo get_the_content();
      }
      
      echo "<br />";
      
      endwhile;
      
      } else {
      
      echo "<form method=\"post\">";
      echo "<label>Number Of Posts</label> <input type=\"text\" name=\"number\" /><br />";
      
      echo "<label>Order</label> <select name=\"order_1\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
      
      echo "<select name=\"order_2\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
      
      echo "<select name=\"order_3\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select><br />";
      
      echo "<label>Separator</label> <select name=\"separator\"><option value=\"|\">|</option><option value=\"tab\">TAB</option><option value=\";\">;</option><option value=\":\">:</option></select>";
      
      echo "<input type=\"submit\" value=\"export\" />";
      echo "</form>";
      }
      ?>
      php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

      Comment

      • druid66
        Confirmed User
        • Feb 2006
        • 994

        #4
        Originally posted by zerovic
        here's another version..sorry, the code is a bit messy, but does the job you need

        this will work with links, titles and descriptions.. you set the number of posts, separator and the order you want to display and it will display it to you...

        again, the code is messy as hell, but it works

        Code:
        <?php
        include('wp-load.php');
        if($_POST['number']) {
        query_posts('showposts=' . $_POST['number']);
        while (have_posts()) : the_post();
        
        if($_POST['order_1'] == "url") {
        echo the_permalink();
        }
        if($_POST['order_1'] == "title") {
        echo get_the_title();
        }
        if($_POST['order_1'] == "description") {
        echo get_the_content();
        }
        
        if($_POST['order_1'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
        
        if($_POST['order_2'] == "url") {
        echo the_permalink();
        }
        if($_POST['order_2'] == "title") {
        echo get_the_title();
        }
        if($_POST['order_2'] == "description") {
        echo get_the_content();
        }
        
        if($_POST['order_2'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
        
        if($_POST['order_3'] == "url") {
        echo the_permalink();
        }
        if($_POST['order_3'] == "title") {
        echo get_the_title();
        }
        if($_POST['order_3'] == "description") {
        echo get_the_content();
        }
        
        echo "<br />";
        
        endwhile;
        
        } else {
        
        echo "<form method=\"post\">";
        echo "<label>Number Of Posts</label> <input type=\"text\" name=\"number\" /><br />";
        
        echo "<label>Order</label> <select name=\"order_1\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
        
        echo "<select name=\"order_2\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
        
        echo "<select name=\"order_3\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select><br />";
        
        echo "<label>Separator</label> <select name=\"separator\"><option value=\"|\">|</option><option value=\"tab\">TAB</option><option value=\";\">;</option><option value=\":\">:</option></select>";
        
        echo "<input type=\"submit\" value=\"export\" />";
        echo "</form>";
        }
        ?>
        didn't tried 1st code, just 2nd one - works perfect!
        thanks a lot, let me know if you would have some asian site i'll help you start with some traffic
        Pure Japan japanese babes blog

        Comment

        • zerovic
          Confirmed User
          • Apr 2010
          • 1116

          #5
          you're welcome! have a great weekend ;)
          php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

          Comment

          • AmeliaG
            Too lazy to set a custom title
            • Jan 2003
            • 10663

            #6
            thanks! I am going to try this
            GFY Hall of Famer

            AltStar Hall of Famer




            Blue Blood's SpookyCash.com

            Babe photography portfolio

            Comment

            • druid66
              Confirmed User
              • Feb 2006
              • 994

              #7
              diggin up my old topic.

              how can i get bulk list of posts with certain category?
              current code list posts from index page what if i want one category only, is it possible?

              this piece of code Zerovic wrote is really useful if i can pick up category i want it will be excellent.
              Pure Japan japanese babes blog

              Comment

              • stoka
                Confirmed User
                • Dec 2005
                • 956

                #8
                include cat variable with query_posts, like

                query_posts('cat=ABC&showposts=' . $_POST['number']);

                where ABC is tag_ID of the category you want

                Comment

                • druid66
                  Confirmed User
                  • Feb 2006
                  • 994

                  #9
                  tried, but if i got let's say "Filipina Sex" category (filipina-sex slug) it should look like this:

                  query_posts('cat=filipina-sex&showposts=' . $_POST['number']);

                  or

                  query_posts('cat=filipina sex&showposts=' . $_POST['number']);

                  ?
                  cuz both ways won't work, still i got list of posts from index page not from filipina sex category.
                  Pure Japan japanese babes blog

                  Comment

                  • stoka
                    Confirmed User
                    • Dec 2005
                    • 956

                    #10
                    get tag_ID for filipina sex by going mouseover that category in wp admin. It's a number

                    here below is a version where you submit tag_ID through form
                    slightly adapted Zerovic's code

                    Code:
                    <?php
                    include('wp-load.php');
                    $args = array(
                    	'cat'     	=> $_POST['tag_id'],
                    	'showposts=' 	=> $_POST['number']
                    );
                    
                    if($_POST['number']) {
                    query_posts($args);
                    while (have_posts()) : the_post();
                    
                    if($_POST['order_1'] == "url") {
                    echo the_permalink();
                    }
                    if($_POST['order_1'] == "title") {
                    echo get_the_title();
                    }
                    if($_POST['order_1'] == "description") {
                    echo get_the_content();
                    }
                    
                    if($_POST['order_1'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
                    
                    if($_POST['order_2'] == "url") {
                    echo the_permalink();
                    }
                    if($_POST['order_2'] == "title") {
                    echo get_the_title();
                    }
                    if($_POST['order_2'] == "description") {
                    echo get_the_content();
                    }
                    
                    if($_POST['order_2'] != "none") { if($_POST['separator'] == "tab") { echo "\t"; } else { echo $_POST['separator']; } }
                    
                    if($_POST['order_3'] == "url") {
                    echo the_permalink();
                    }
                    if($_POST['order_3'] == "title") {
                    echo get_the_title();
                    }
                    if($_POST['order_3'] == "description") {
                    echo get_the_content();
                    }
                    
                    echo "<br />";
                    
                    endwhile;
                    
                    } else {
                    
                    echo "<form method=\"post\">";
                    echo "<label>Tag_ID</label> <input type=\"text\" name=\"tag_id\" /><br />";
                    
                    echo "<form method=\"post\">";
                    echo "<label>Number Of Posts</label> <input type=\"text\" name=\"number\" /><br />";
                    
                    echo "<label>Order</label> <select name=\"order_1\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
                    
                    echo "<select name=\"order_2\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select>";
                    
                    echo "<select name=\"order_3\"><option value=\"none\">None</option><option value=\"url\">URL</option><option value=\"title\">Title</option><option value=\"description\">Description</option></select><br />";
                    
                    echo "<label>Separator</label> <select name=\"separator\"><option value=\"|\">|</option><option value=\"tab\">TAB</option><option value=\";\">;</option><option value=\":\">:</option></select>";
                    
                    echo "<input type=\"submit\" value=\"export\" />";
                    echo "</form>";
                    }
                    ?>

                    Comment

                    • EddyTheDog
                      Just Doing My Own Thing
                      • Jan 2011
                      • 25433

                      #11
                      Another way - Go to tools and export what you want:



                      You can then import that into Excel or another spreadsheet and play with the data as much as you want - Then just save it as a CSV (pipe delimited) - It would give you more control over the data...

                      Comment

                      • druid66
                        Confirmed User
                        • Feb 2006
                        • 994

                        #12
                        almost perfect sir ;)
                        but smths is wrong with code.
                        when i choose 10 posts to be listed it lists 30+ posts
                        if ill choose to have url+description here's what i got:

                        Page not found | Asian Sex[gallery link="file" ids="14862,14863,14864,14865,14866,14867,14868,148 69,14870,14871,14872,14873,14874,14875,14876,14877 ,14878,14879,14880,14881,14882,14883,14884,14885"]|

                        beside this it's very ok, i can live without descriptions if it's a problem, however i don't know why it list 30 posts instead of 10 but if i put there 60 posts it's grabbed 60 so it's ok for me.

                        thanks a lot for willing to help so far, appreciate
                        Pure Japan japanese babes blog

                        Comment

                        • stoka
                          Confirmed User
                          • Dec 2005
                          • 956

                          #13
                          well dunno I only slightly changed the code, will take a closer look later today

                          from what I see above it outputs posts, not excerpts
                          if you have excerpt (description) for each post then you could get descriptions by replacing get_the_content() with the_excerpt ()

                          and it's simple code, go always with all parameters

                          Comment

                          • stoka
                            Confirmed User
                            • Dec 2005
                            • 956

                            #14
                            Originally posted by EddyTheDog
                            Another way - Go to tools and export what you want:
                            yea this kind of solves it

                            Comment

                            • druid66
                              Confirmed User
                              • Feb 2006
                              • 994

                              #15
                              thank you both guys Eddy and Stoka i've probably overcomplicated it using this script i didn't know about export option in wordpress i must admit :P

                              and thanks again Stoka for adding tag option for script, i like it and using it now ;)
                              Pure Japan japanese babes blog

                              Comment

                              • blogspot
                                So Fucking Banned
                                • Jan 2016
                                • 292

                                #16
                                congrats all

                                Comment

                                Working...