WordPress.org

Support

Support » How-To and Troubleshooting » use wp functions outside wordpress and in a different domain name

use wp functions outside wordpress and in a different domain name

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Frumph
    Participant

    @frumph

    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?

    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.

    Frumph
    Participant

    @frumph

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

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘use wp functions outside wordpress and in a different domain name’ is closed to new replies.