WordPress.org

Ready to get started?Download WordPress

Forums

WordPress permalink from the database? (1 post)

  1. robolist
    Member
    Posted 1 year ago #

    I am trying to access selected post information from my WordPress database to display on a second website which is not a WordPress site nor is it php, it is in fact an asp.net website that i want to display the information on.

    I have a WordPress blog at blog.domain.com and another website at domain.com both running on different servers and I need to display the excerpt, title with link on my asp.net website for selected posts. I can easily grab the excerpt and title from the blog's database but the only problem is that the permalink is not in the database.

    I had the idea that maybe if I place a short piece of code on every blog to insert the permalink to a new table, i could then grab that to use over on the other website. But that didnt work, perhaps I am not doing it right. This is the code I used;

    <?php
     global $wpdb;
     $table_name = $wpdb->prefix . "posts_pages_url";
     $wpdb->insert($table_name , array('post_id' => the_ID(), 'url' => the_permalink()));
    ?>

    Some might say, "why dont you just use an RSS Feed?" Well if it comes down to it, I just might have to, but i would prefer not to as connecting to the database directly to access my selected posts is much more flexible.

    I would be very grateful if anyone had any suggestions on how I can access the permalink via a database call.

    Many thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.