• Resolved tsimmons

    (@tsimmons)


    I have several external pages that use the WP theming engine (see instructions at https://codex.www.ads-software.com/Integrating_WordPress_with_Your_Website) … the problem is when I upgraded to WP3.0, these pages now don’t work as expected.

    Instead of getting the WordPress header, sidebar and footer with my content in the middle, I’m getting what appears to be either a “Page not found” or the homepage (depending on the URL).

    Here is a test page that produces the 404:

    <?php
    	require('../../wp-blog-header.php');
    	get_header();
    ?>
    	<h1>This is a test</h1>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    This page worked fine under 2.9.2. Any ideas?

    Thanks &
    Cheers,

    Toby

Viewing 6 replies - 16 through 21 (of 21 total)
  • No I am not getting any result will any body help?????????

    Thanks for the answer tsimmons ??

    I use WP 3.01 and tried to load (in ajax, with jQuery) content from an external page … I used require('./wp-blog-header.php'); but i always got 404, even with the correct path !

    I just replaced with require_once("./wp-load.php"); and it works like a charm now !

    Thanks again

    This works quite well! Thanks for this tip. Anyone know how to forge a title for any page outside of WP that you include? Any sort of VAR that you could pass to get_header() or get_title() that would pass as a <title>My Blah Blah</title> page?

    Thanks,

    Chuck

    Yes, that solution does work great – but I second the question of cewyattjr – does anyone know how to pass a title variable into the external pages?

    @mountainporcupine


    <?php
    require('./wp-load.php');

    function assignPageTitle(){
    return "My Page Title Here";
    }
    add_filter('wp_title', 'assignPageTitle');
    ?>

    This doesn’t make sense? Why would I want the header, sidebar, or footer in my form action php file? All I want to do is use ajaxform() to call my action php file and maybe return something to a div somewhere on the page. I get 404 of course but I don’t want the header being returned or anything else. I just want to email the form data. none of the wordpress form plugins will make tabular forms the way I want and I can’t add what content I want where I want so I’m not using a plugin. just jquery ajaxform() and a simple php file.

    I tried require_once("./wp-load.php"); and it didn’t work. My form looks like: <form id="form0" action="bbaction.php" method="post">
    bbaction.php looks like:

    <?php
    require_once("./wp-load.php");
    foreach($_POST as $name => $value) {
    	print "$name : $value<br>";
    }
    ?>

    (for now I’m just trying to print the results to a div on the page so I can style what the email will look like)
    and then my js looks like this:

    $(document).ready(function() {
        var options = {
            target: '#test'
        $('#form0').ajaxForm(options);
    });

    Anyone know what I’m doing wrong?

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Integrating WP in external PHP pages’ is closed to new replies.