Support » Fixing WordPress » Is there a way to show my latest post in my website?

  • Hi guy!

    I’m really new this forum and I have my own site made it in PHP (I’m not using any CMS) I just want to know if there is a way or a php script that I can use to show my latest wordpress blog posts or news and category? Or something similar to what I need?

    I really need to know this because I want to show my latest news or posts in my personal site.

    I will appreciate any help.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Perhaps you can display the RSS entries for the blog on your existing site. That may not get category changed events though. Take a look at WordPresses RSS importers php code to see how they use the feed.

    <?php require('path/to/wp-blog-header.php');
    query_posts('showposts=1');
    while (have_posts()) : the_post(); ?>
    <?php the_title(); ?>was just posted in <?php the_category(', ') ?>
    <a href="<?php the_permalink() ?>" rel="bookmark">Read More</a>
    <?php endwhile;
    ?>

    will show the latest post title with the category.

    READ about template tags in the codex if you want to edit that.

    Thanks for the reply…

    Well I tried the code above but is not working… the link to my blog is: http://jcroot.net but the correct path to the “wp-blog-header.php” is: http://jcroot.net/blogpress/wp-blog-header.php

    This is because I move my blog index.php to the root directory.

    I created a php file to test the code the whooami gave me but I can’t get it working…

    Here is the test link:

    http://prueba.jcroot.net/wordpress.php

    And this is what I have inside wordpress.php

    <?php require('http://jcroot.net/blogpress/wp-blog-header.php');
    query_posts('showposts=1');
    while (have_posts()) : the_post(); ?>
      <?php the_title(); ?>
      was just posted in
      <?php the_category(', ') ?>
      <a href="<?php the_permalink() ?>" rel="bookmark">Read More</a>
    </p>
    <?php endwhile;
    ?>

    <?php require('http://jcroot.net/blogpress/wp-blog-header.php');

    No.

    Thats not a path, thats an absolute URL.

    If the file you are trying to put this stuff on is inside a folder named prueba, than your path to wp-blog-header.php is :

    ../blogpress/wp-blog-header.php

    whooami,

    Thanks man, now it seems to be working… searching on google.com I found this script: http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

    This wil allow me to add any RSS to my website in a really cool way, reading some posts here I find out the my RSS files are: wp-feed.php wp-rss.php wp-rss2.php so I’m a little confuse… I don’t know which one to use for the script above, the script is asking me to enter my RSS link and if I enter any of these links it will work but the thing is that it won’t show a description of my post or news, the script is suppose to show the description and the title but with my RSS is not showing.

    Can you be able to help me with this please?

    Take a look to the script:

    http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

    Thanks man, now it seems to be working…

    What is working?

    The PHP script you gave is working…

    Here:

    http://jcroot.net/test/wordpress.php

    But the think is that I want the script to show a least the last 3 posts of my blog with a little description of it, is this possible?

    yes, change the 1 to a 3

    query_posts('showposts=3');

    description .. use the excerpt

    Like I said, READ about template tags in the codex if you want to edit that.

    Ok thanks man… 2 more questions and almost done.

    Can I be able to use this script even when my blog is in my subdomain?

    Example… I want to show the latest 3 posts from my blog in my website, my website is in the main root of my domain example: http://www.somedomain.com

    And my blog will be: http://www.blog.somedomain.com

    One more question, where is the “template tags in the codex”? sorry for my ignorance.

    Ok thanks man
    You repeat that once more and SHE will not answer any of your questions 🙂

    Can I be able to use this script even when my blog is in my subdomain?

    Yes. Just make sure you use the right path to wp-blog-header.php

    Where are template tags in the codex ..

    http://codex.wordpress.org/Template_Tags

    the _title is a template tag, for instance. Its shows the title of the post.

    As long as you ‘include’ wp-blog-header.php, you can use ANY template tags you like in that snippit above,

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Is there a way to show my latest post in my website?’ is closed to new replies.