WordPress.org

Ready to get started?Download WordPress

Forums

use wp functions outside wordpress and in a different domain name (5 posts)

  1. Mr BaDr
    Member
    Posted 1 year ago #

    hi there,

    i try to call a wordpress function from my blog located at (mysite1.com/blog/) to be show in my other site located in (mysite2.com) the two sites are hosted in the same server.

    site 1: /home/mysite1.com/blog/
    site 2: /home/mysite2.com/

    this work fine if i try to use it in the same domaine (mysite1.com/forum) but is broken in the other domain (mysite2.com)

    <?php
    require( '../blog/wp-load.php' );
    query_posts('showposts=3');
    while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endwhile;?>

    If you have any idea, do not hesitate to share with us, thanks.

    Best regards.

  2. Frumph
    Member
    Posted 1 year ago #

    Function references are hierarchical top down from the installation of WordPress, loading from 'above' and then to the side of WP should not be possible.

    How you got it to work in ../Forum/ is interesting. Maybe the hooks for get_ URI require the domain be be the same?

  3. Mr BaDr
    Member
    Posted 1 year ago #

    By following this reference Integrating WordPress with Your Website

    yes, i get it work in /forum simply with this lines of code:

    <?php require( '../blog/wp-load.php' );
    query_posts('showposts=3');
    while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endwhile; ?>

    but in a different domain it doesn't work.

  4. Frumph
    Member
    Posted 1 year ago #

    .. the require would be ../mysite2.com/wp-load.php (by your example of directory structure).. make sure you have your pathing correct

  5. Mr BaDr
    Member
    Posted 1 year ago #

    yes i'm sure, and it find function but he don't show the result

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.