WordPress.org

Ready to get started?Download WordPress

Forums

What wp header code do I use in non-wp pages? (20 posts)

  1. elyonline
    Member
    Posted 8 years ago #

    Hi all,

    Could you tell me what wp code I use to pull in a wp side bar in a non wp page.

    Since I upgraded to 2.02 my pages no longer load. see here: http://www.elyonline.co.uk/events for example.

    This page used to work before I upgraded.

    Any ideas?

    Thanks

  2. elyonline
    Member
    Posted 8 years ago #

    I forgot to say, I use this at present in the non-wp pages so I can get the wp-sidebar working with them:

    <?php

    /* Use WP Templating System */
    require('../news/wp-blog-header.php');
    ?>

    By the way, could someone confirm I get a 404 on this page: http://www.elyonline.co.uk/events/

    Many thanks

  3. moshu
    Member
    Posted 8 years ago #

    The page you linked displayes perfectly in my browser.

  4. Lester Chan
    Member
    Posted 8 years ago #

    okie, this is exactly the same problem I am having on wp-stats.php, wp-poll.php and wp-useronline.php

    In FF1.5, IE7 Beta it works fine, but when viewed in IE6, it will get a 404.

  5. elyonline
    Member
    Posted 8 years ago #

    Yup, IE6 ain't showing me anything and when google sitemap trawls my site It says for the events page and my contact page: http://www.elyonline.co.uk/contact/

    Thanks

  6. lxg
    Member
    Posted 8 years ago #

    Never heard of a 404 producing client-side differences. elyonline, note the difference between your two links: one is with trailing slash, the other without. This can be a major problem.

    However check out this:
    http://www.schroepl.net/cgi-bin/http_trace.pl?url=http%3A%2F%2Fwww.elyonline.co.uk%2Fevents%2F&method=GET&version=HTTP%2F1.0

    Your server sends a 404 and yet delivers content. :-/

  7. elyonline
    Member
    Posted 8 years ago #

    C**p, what could be causing that? Anyone?

    Thanks for the head's up, Mastermind.

  8. lxg
    Member
    Posted 8 years ago #

    Have you possibly manually modified your .htaccess file? If so, could you please post it?

  9. elyonline
    Member
    Posted 8 years ago #

    Hmmmmm, not really, just the standard 2.02 version of htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

  10. lxg
    Member
    Posted 8 years ago #

    Well, I'm clueless now.

    Do you have any strange plugins installed?

    I also could imagine a bug in Apache or a module, or possibly you have misconfigured your Apache server (httpd.conf), or you have a weird combination of Apache modules. Which Apache version do you use, and did you do something daring on the config?

    btw, it seems you're using PHP 4.4.0 -- in this version lots of bugs (some of them security related) were detected. If you can, you should maybe consider upgrading PHP anyway.

  11. Lester Chan
    Member
    Posted 8 years ago #

    so is this a php bug?

  12. lxg
    Member
    Posted 8 years ago #

    I wouldn't dare to say this is a PHP bug, after nothing more than a remote diagnosis. ;-)

    I just said that it might be a bug, and that I -- in general -- would advise to upgrade from PHP 4.4.0 to a current version.

    GamerZ: Would you maybe also like to test your erroneous page(s) with http://www.schroepl.net/cgi-bin/http_trace.pl and/or post your URLs here -- maybe we can find some similarity.

  13. Lester Chan
    Member
    Posted 8 years ago #

    sure thing mastermind, but I am using the plugin on my page and it works just fine, php 4.4.2. I will get my user to report their php version.

    Actual page:
    http://www.krankenversicherung.lt/wp-stats.php
    My user site tracing:
    http://www.schroepl.net/cgi-bin/http_trace.pl?url=http%3A%2F%2Fwww.krankenversicherung.lt%2Fwp-stats.php&method=HEAD&version=HTTP%2F1.0

    it got a 404 on the trace. weird

  14. elyonline
    Member
    Posted 8 years ago #

    Hmmmm very strange.

    All I know is that since I upgraded the non-wp pages no longer feature in google search, prior to upgrade one phrase was no 1 in the search.

    I guess thats because Google is reading it as a 404.

    Any other suggestions?

    Thanks

  15. lxg
    Member
    Posted 8 years ago #

    I suppose the error to be in the Apache config (section error handling).

    If it's your server: Have you changed the Apache config?
    If it's a shared server and you're not admin: Do others have the similar problems? Could you possibly notify your host master?

    The best would possibly be to update your Apache and PHP, or change your host.

  16. elyonline
    Member
    Posted 8 years ago #

    I checked with my host and he says everything is fine with Apache, he said the problem lies with the page.

    Could anyone check my page (if they have time): http://pastebin.com/642663 and tell me if they see anything un-to-ward?

    Many thanks
    Karl

  17. lxg
    Member
    Posted 8 years ago #

    I just c&p'ed it in an own php and exececuted it on my machine. It gives me the following (PHP 5.1.1):
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/localhost/htdocs/test.php on line 68

  18. lxg
    Member
    Posted 8 years ago #

    By the way, I see you are trying to mark the current item via a regex action. You might want to try this plugin which automatically outputs a pages list and marks the current item with an own class "current_page_item".

  19. elyonline
    Member
    Posted 8 years ago #

    Thanks Mastermind,

    Hmmm, still unsure what is going on here.

    I don't get that error.

  20. ardamis
    Member
    Posted 7 years ago #

    Try:

    <?php
    require('./wp-config.php');
    $wp->init();
    $wp->parse_request();
    $wp->query_posts();
    $wp->register_globals();
    ?>

    This seems to throw the desired HTTP Status Code: HTTP/1.1 200 OK while allowing the non-WordPress page to use WP tags and themes.

    A more complete description of the method: http://www.ardamis.com/2006/07/10/wordpress-googlebot-404-error/

    Good luck.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags