Forums

[resolved] Including wordpress widgets etc in non-wp pages (4 posts)

  1. eggy90
    Member
    Posted 6 years ago #

    How can I include a wordpress widget on another part of my site.

    For example, i have my blog at domain.com/blog with a calendar plugin and widget installed. How can I make the calendar widget appear on a different page (domain.com/events.php)?

    Any help would be very grateful

  2. vkaryl
    Member
    Posted 6 years ago #

    If this is 2.1, I'm not sure what I know how to do in 2.0 will work.

    That caveat entered, here's what you do to enable this sort of functionality:

    Before anything else (even the doctype!) on the page where you want the wp functionality to appear, place this code:

    <?php
    require_once('/home/username/public_html/wp/wp-blog-header.php');
    define('WP_USE_THEMES', false);
    ?>

    Note that that server-path string is the sort one has on some servers; there are others. If you don't know what your specific server-path really is, ask your host support staff.

    Once that's in place, then put the "bits" where you want them in your page.

    Couple other caveats:

    1. I haven't ever tried this with widgets. It may work fine, but I can't say definitively.

    2. If the wp install you want to scab the widgets from lives on another domain in your server space (or sometimes even in another area of your folder structure) you may run into the "open_basedir restriction". If so, the only thing I can tell you to do is use wpget - a specifically tweaked wpget - and if this happens to you, post back and we'll go from there.

  3. eggy90
    Member
    Posted 6 years ago #

    Brilliant thanks! Works fine

  4. vkaryl
    Member
    Posted 6 years ago #

    Glad to hear it.... mark this as resolved then please and thanks?

Topic Closed

This topic has been closed to new replies.

About this Topic