How do you link to the latest post from outside of the wordpress directory?
-
Okay, for my portfolio site, I have word press on a separate section of the site, since it’s just for posting updates and news. I’d like to add a little link in the footer of my site that links directly to the most recent article posted, and of course writes the link as the title of said post. Obviously I’d like to do this in php rather than update it manually.
So far I’ve tried including this line of code into my navfooter.php file, which loads on all other pages of my site.
<?php $wp_did_header = true; require_once('blog/wp-load.php'); wp();?>
I’m assuming that wp-load.php loads all the functions for accessing the database, but i’m just guessing, but i’m positive it’s not the template-loader.php file.
So, does anyone know what code I need to add? I just need to have it write the link to the post, probably using the same code as on the blog page itself:
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
or slightly different. I’m just starting to learn php, and all I’ve really learned is includes, not so much functions.
- The topic ‘How do you link to the latest post from outside of the wordpress directory?’ is closed to new replies.