Home

Advertisement

Wordpress functions in other pages

  • Oct. 19th, 2008 at 2:28 PM

Originally published at Random Geekage You can comment here or there.

I have rediscovered a cool thing that can be done with Wordpress involving static pages. I run my site with a static index.php as the front page. It would be a massive pain in the ass to re-theme it every time I changed my Wordpress theme, along with any other pages I make. I remembered something in the documentation about adding a line of code to your php files and being able to access all the functions available in Wordpress and went looking, unsuccessfully.

I then remembered that the index.php file of a Wordpress install contains something like what I was looking for. I copied it (require(’./path/to/wp-blog-header.php’) ) into the front page along with the functions to display the header, sidebar and footer (get_header(), get_sidebar() and get_footer() respectively) and found that it worked.

Full code for this is below (assumes that your wordpress install is in /wordpress and your page is in the root of your site)


<?php require('./wordpress/wp-blog-header.php'); ?>
<?php get_header(); ?>
<div id="container">
<div id="content">
<!--your stuff goes here-->
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
</div>
</body>
</html>

Back to Wordpress

  • Oct. 6th, 2008 at 10:20 AM

Originally published at Random Geekage You can comment here or there.

So I decided to move back to Wordpress. The benefits of using Wordpress as my weblog software far outweigh the negatives, for example, I can update from pretty much anywhere, managing posts is a lot easier, the plugins make my life a breeze (backups, crossposting to my livejournal, spam control), its just a better choice for me.

Don’t get me wrong, BashBlogger is pretty good but I got somewhat tired of having to hand type all the code for each entry and manually pushing the updates to the server. Plus the commenting system (emails copied and pasted into each entry manually) was crap.

I just can’t stay away from Wordpress, makes weblogs so easy.

Latest Month

December 2009
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

Tags

Syndicate

RSS Atom
Powered by LiveJournal.com
Designed by Lilia Ahner