04 May 2009

Using WordPress with Rapidweaver

Technology 13 Comments

Have you ever wanted to use posts from your WordPress blog within your Rapidweaver website? I did. I searched and searched to find out how, but never found the answer that worked for me… until now. I wanted to design a nice website, separate from my blog, using Rapidweaver. I then wanted to take a certain “Category” of posts from that blog and use them within my Rapidweaver pages. I wanted to have a central place for blogging that I could use to populate posts in my Rapidweaver sites.

The technique, in its simplest form, is easy to do. I have created a screencast to get you through those steps. I will go over those steps here.

  1. Create a STYLED TEXT or HTML CODE page from the ADD PAGE dialog.
  2. open PAGE INFO dialog and choose HEADER
  3. Now choose PREFIX
  4. enter this code in the box:
    <?php
    // Include WordPress 
    define('WP_USE_THEMES', false);
    require('../blog/wp-blog-header.php');
    query_posts('cat=147');
    ?>
  5. Make sure the “require” tag points to your wp-blog-header.php file using a relative address 
  6. on the “query_posts” line, I chose to use a specific category. I chose category 147. To find the category number, go to your WordPress admin panel. choose POSTS, on the left side. then choose CATEGORIES. What you do is hover your mouse over the category you want to use and it will show you the id number. In Safari it also displays it in the status bar. This will be the number you use for posting from that category.
  7. Next, click in the actual page content and place this code where you want it to display: 
  8. <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_excerpt(); ?>
    <p><a href="<?php the_permalink(); ?>">Read more...</a></p>
    <?php endwhile; ?>
  9. That is it!

There are lots of things you can do with this using various tags. For instance, you could change “excerpt” above to “content” to display full posts. You could also change the “Read more…” to anything you want. In the the code used in the PREFIX box in Rapidweaver, you could use categories or posts in the “query_posts” section, with a plethora of other possibilities. For further research on customization, go to the query_posts documentation.

This is just the basics to get you started, and once you dive into using what is called the “The Loop” from WordPress, you will find all kinds of customization possibilities.

If this post has helped you or you have questions, please use the comments.

Get the Flash Player to see the wordTube Media Player.

13 Responses to “Using WordPress with Rapidweaver”

  1. HansOffenburg says:

    Hello,

    I try to use your example, but it don’t work. I don’t see posts on the page and if I klick on the “read more…” I get the “” into the URL.

    So what I do wrong? My page is on http://www.glomme.de and the wordpress dir is at http://www.glomme.de/wordpress/

    It would be nice if you can help me with that :)

    Thank you for your help and excuse me my maybe badly english :)

    Greetings out of Offenburg Germany
    Hans

    • Heath McConnell says:

      I had this same problem for months. You must have your directory structure and corresponding relative URL set correctly. Is your wordpress install on the same domain? Is it on the same hosting account?

      Using the relative URL I posted in the code, takes you out of your domain folder on the server and into another domain folder where the important wp-blog-header.php file is. In the example code I used “blog” as the sub-folder because that seems to be what most people use, it can be whatever folder your WP install is in.

  2. Hans Glomme says:

    Hello,

    yes the WP ist installed on the same domain. My structure is :
    /
    ……/wordpresss

    So under the root is my WP directory.

    So I put following URL (rel.) into the code:

    equire(‘../wordpress/wp-blog-header.php’);

    And yes it’s on the same hosting account. Because it’s on my root server.

    If you want you can have a look. The page you can look at :
    http://www.glomme.de/page8/page8.html

    That’s the page where I put your code into.

    Thank you for your help :)

    Greetings
    Hans

    • Heath McConnell says:

      You want the relative URL to point to the file we are calling on in our web page. So, the relative URL, in your case, should be something like this…

      ./[WP install folder]/wp-blog-header.php

      Remember a double ..(period) to go back out of the current folder to the root, and then the directory location TO the file in your WP install.

      I think this might work.

      If you meant that you installed wordpress into the root, you would eliminate the wordpress section ot the URL like so:

      ../wp-blog-header.php

      that should work for a root install

  3. Кеша says:

    great! this is what I was looking for

  4. Carol Lapinski says:

    Heath Help! I’m not a programmer or website guru…I am struggling with setting up my wp blog in rapidweaver. I have the wp-blog but can’t figure this out. Here’s the error I get:

    Warning: require(./../www.calfundrecovery.com/wordpress/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /hermes/web10/b930/moo.carollapinski1/page1/page1.php on line 1

    Fatal error: require() [function.require]: Failed opening required ‘./../www.calfundrecovery.com/wordpress/wp-blog-header.php’ (include_path=’.:/usr/local/lib/php-5.2.1/lib/php’) in /hermes/web10/b930/moo.carollapinski1/page1/page1.php on line 1

    • Heath McConnell says:

      Carol,
      I do not use the plugin WP-Blog in Rapidweaver because I could never get it to work the way I wanted. That being said, your problem appears to be in your relative URL and where you are telling WP-Blog where the file is. You might try getting support for your plugin with Roger, who is very helpful at http://nilrogsplace.se/support/ (WP-Blog support website)

  5. Robert says:

    Thank you. Finding a good resource on WordPress & Rapidweaver is difficult.

  6. DANNY says:

    HI HEATH,

    thanks for this info above.

    I am trying to set up a wordpress blog for my website listed above, instead of the standard Rapidweaver blog. I also want my client to be able to blog remotely from her office location into wordpress.

    Do you have any recommendations or suggestions. I am not too tech-savvy but i can learn quickly.

    Thanks for your earliest reply,

    Danny

    • Heath says:

      @Danny
      Setting up a wordpress (WP) blog in a rapidweaver (RW) site is a very frustrating experience. The reason many people use RW is the easy of use, same with WP, but integration of the two… I am still working on it.

      I started with “the loop”, as mentioned in the post, however, my php code skills were weaker than my design requirements… so I chose to use a “Offsite page” plugin in RW to take clients to my blog and a “Page-Links-to” WP plugin for a return trip. I want to integrate WP into my RW site in a way that doesn’t look hokey. It tried using the WP loop myself and coding it in, but it just didn’t look professional. I then tried to use the WP-Blog RW plugin by Nilrog, however It will not work in my situation, but it may in yours. You my want to try it out.

      One thing you will not get around, at least last time I checked, is that the blog posts on your site are going to take clients to your actual WP blog if they click a permalink or want to comment, etc. Not an issue to some, but if you are trying to keep them on your site it defeats the purpose. It is not uncommon to have your blog as a separate site, and linked just as you would your twitter, facebook, or linkedin pages.

      As far as blogging remotely… That one is a cinch. You have your client register with your WP blog. You then go into USERS>AUTHORS USERS and change them from a subscriber to one of the other “ROLES” (You should read up on roles here).

      I hope this helps

      P.S. now that you brought this up, I am going to take another look into using the WP “loop” to my advantage some how.

  7. Frode says:

    Hi
    I am trying to figure out, what the relative URL is for my WP blog. I am trying to fetch all my posts at frodelundsten.wordpress.com into a HTML page in RapidWeaver, http://www.strategy2tactics.dk.

    Can you help me?

    Regards
    Frode

  8. Lynnette Sakihara says:

    Excellent wordpress post, I will save this post in my Del.icio.us account. Have a awesome evening.

Leave a Reply

Heath McConnell is Stephen Fry proof thanks to caching by WP Super Cache