WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How To Export / Create List Of All My Blog Post URL's? (16 posts)

  1. jasonpel
    Member
    Posted 3 years ago #

    Hi,

    Does anyone know how to export or create a list of all post URL's contained on a blog? I have literally 100's of posts and I would like to create a simple list of all of their URL's. Is there a script or plugin that can automate this?

    Thanks!

  2. You might try something like this.

    It seems like there isn't a streamlined way to accomplish this short of the method I linked above or exporting posts to a csv and manually removing columns.

  3. tigtog
    Member
    Posted 3 years ago #

    <ul class="archives">
    	<?php wp_get_archives( array( 'type' => 'postbypost' ) ); ?>
    </ul><!-- .archives -->

    If you create a page template (e.g. list-posts.php) and put the above code in the main content section, you should get your list of posts.

  4. jasonpel
    Member
    Posted 3 years ago #

    Thanks Drew!

  5. jasonpel
    Member
    Posted 3 years ago #

    tigtog,

    Is there a way to get a list of urls like:

    http://mysite.com/sample-post

  6. tigtog
    Member
    Posted 3 years ago #

    Sorry, can't see anything there, Jason.

    Page Not Found - 404 Error Page
    The page you are looking for (http://mysite.com/sample-post) is not here.

    You can limit the number of posts shown in such a list to just the latest 30 or 50 or whatever - I've used the following code to list posts + number of comments in the sidebar of an archives page:

    <h3>Last 50 Articles</h3>
    showing comments per post<br />
     <ul>
    <?php query_posts('showposts=50'); ?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> - (<?php echo $post->comment_count ?>)</li>
    <?php endwhile; endif; ?>
     </ul>
  7. esmi
    Forum Moderator
    Posted 3 years ago #

    I think jasonpel is looking for a list of urls in the format http://mysite.com/sample-post

  8. tigtog
    Member
    Posted 3 years ago #

    d'oh - I see what you mean.

    You should be able to modify the code above to just list the permalinks without adding the title stuff.

    <h3>Last 50 Articles</h3>
     <ul>
    <?php query_posts('showposts=50'); ?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<li><?php the_permalink() ?></li>
    <?php endwhile; endif; ?>
     </ul>

    {edited to correct code - a couple of extraneous characters hadn't been removed from previous more complicated code)

  9. jasonpel
    Member
    Posted 3 years ago #

    tigtog, awesome! but is it possible to list ALL posts urls with the title separated by a comma?

    Like: http://www.mysite.com/sample-post,Sample Post

    And is it possible to create a page template and appy it to only one page so that all of the other pages on the site retain their original format?

    Thanks for your help! :)

  10. jasonpel
    Member
    Posted 2 years ago #

    thank you tigtog! works great... :)

  11. mgason
    Member
    Posted 2 years ago #

    Hi jasonpel,
    sounds like you may have received some further assistance with this? Did you get it to a point where it showed all Urls with full title. If so please share, I need that exact thing right now.

  12. isocialmarket
    Member
    Posted 2 years ago #

    hey jasonpel or mgason,

    i'm interested in the same, can you share any additional help you received.

    thanks.

  13. mgason
    Member
    Posted 2 years ago #

    It depends what you want to do with it.
    I did not add it to a page and style it. You could easily.
    I just had it load raw to my browser window, a big list. Then I did a copy and paste and imported into Excel. My client just wanted a list he could check when moving his site.
    The code is below, if it does not paste properly to comments here post again and give me an email. I will send you a file.

    To run this you just make it a php file, say export.php, then put that in the root of your site. Go to a browser and type
    yourSiteName.com/export.php
    The list will appear in the browser.
    To also list images and attachments uncomment the global block near the top. As it is it gives you post type, url, title

    [Code moderated as per the Forum Rules. Please use the pastebin]

    To import to Excel,
    copy and paste from browser to a plain text file,
    save that as a someName.csv
    Then in Excel, file new,
    select import on file menu,
    select csv as the type,
    select your file,
    select delimited, click next
    select Tab as the only delimiter, click next
    select each column in the data preview on dialog box and set column data format = text for each, when you have done all of the columns click next
    click finish
    click ok on last dialog.

  14. jasonpel
    Member
    Posted 2 years ago #

    mgason, thanks! can you please post code to pastebin? http://wordpress.pastebin.com/

  15. mgason
    Member
    Posted 2 years ago #

    ignore the original comment about changing code blocks, I updated the code so you just change 1 word to also list images. Explained in comments in code
    http://pastebin.com/qEMbQ8Xj

  16. jasonpel
    Member
    Posted 2 years ago #

    @mgason - cool, i copied the raw code and pasted it to a php file, uploaded it to the root folder, opened it in a browser, and it worked great!

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic