GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How to make bulk list from Wordpress posts? (https://gfy.com/showthread.php?t=1166700)

druid66 05-15-2015 02:49 AM

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?

zerovic 05-15-2015 07:27 AM

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>";
}
?>


zerovic 05-15-2015 07:54 AM

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>";
}
?>


druid66 05-15-2015 08:40 AM

Quote:

Originally Posted by zerovic (Post 20474939)
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 :thumbsup

zerovic 05-15-2015 09:08 AM

you're welcome! have a great weekend ;)

AmeliaG 05-15-2015 09:10 AM

:thumbsup thanks! I am going to try this :)

druid66 02-23-2016 12:34 AM

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.

stoka 02-23-2016 01:29 AM

include cat variable with query_posts, like

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

where ABC is tag_ID of the category you want

druid66 02-23-2016 01:51 AM

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.

stoka 02-23-2016 02:16 AM

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>";
}
?>


EddyTheDog 02-23-2016 02:24 AM

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

http://i.imgur.com/MWbjdAz.png

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...

druid66 02-23-2016 02:26 AM

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 :thumbsup

stoka 02-23-2016 02:51 AM

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

stoka 02-23-2016 03:11 AM

Quote:

Originally Posted by EddyTheDog (Post 20736243)
Another way - Go to tools and export what you want:

yea this kind of solves it

druid66 02-23-2016 09:13 AM

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 ;)

blogspot 02-23-2016 12:42 PM

congrats all


All times are GMT -7. The time now is 08:31 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc