WordPress.org

Ready to get started?Download WordPress

Forums

Sidebar Export on Different Pages/Website (15 posts)

  1. coolbunny
    Member
    Posted 7 years ago #

    Hello,
    I have blog in directory say abcblog.somedomain.dom, and i want the sidebar that is displayed at abcblog.somedomain.dom on somedomain.dom, so basically want sidebar to display on other pages other than default wordpress installation directory.

    Any idea if it is feasible or has been done or could be done ?

    Thanks

  2. tsguitar
    Member
    Posted 7 years ago #

    Including WordPress content on pages outside the WordPress directory has been covered a lot of places. Did you do your own search for this first?

    <?php
    /* Short and sweet */
    require('path/to/wp-blog-header.php');
    ?>

    Put that at the top of any page you create and it's linked in to WordPress. You can now just type <?php get_sidebar(); ?> on that page and you'll have your sidebar.

  3. coolbunny
    Member
    Posted 7 years ago #

    I did try that before posting here, and it always says " Install wordpress " and directs me to install page instead, thats why i posted.

  4. whooami
    Member
    Posted 7 years ago #

    thats sounds like because you dont have the path/to part above right.

  5. coolbunny
    Member
    Posted 7 years ago #

    i used <?php
    /* Short and sweet */
    require('.abcblog/wp-blog-header.php');
    ?>

    Shall i be using /home/user/path/ ? instead?

  6. coolbunny
    Member
    Posted 7 years ago #

    Still same thing : It doesn't look like you've installed WP yet. Try running install.php.

    used /home/user/public_html/blog/wp-blog-header.php

  7. whooami
    Member
    Posted 7 years ago #

    require('.abcblog/wp-blog-header.php'); <-- thats NOT a proper path on ANY filesystem.

    you use whatever the path is

    if the file is in the same directory as wp-blog-header.php the path is this:

    require('./wp-blog-header.php');

    if the file is in a subdirectory it will look like this:

    require('../wp-blog-header.php');

    you cant just "guess" at these things.

  8. coolbunny
    Member
    Posted 7 years ago #

    I tried everything, and the best it does is : It doesn't look like you've installed WP yet. Try running install.php.

    I am just trying to include sidebar on a directory script , putting the code in the index.php page :(. Why does it keep saying to install it though when path is defined properly ?

    I have used

    require('./blog/wp-blog-header.php');
    require('../wp-blog-header.php');
    require('./directoryblog/wp-blog-header.php');
    require('/home/user/public_html/blog/wp-blog-header.php');

    Still getting no where :(.
    Does wordpress support export of sidebar and its elements on different directory/page running some different script? And not just simple .php page.

  9. coolbunny
    Member
    Posted 7 years ago #

    Ok so it works on simple .php file not one smarty based script at all, anyone got this working on their directory or smarty based and fully coded php file ? So, that i can get it going ?

  10. whooami
    Member
    Posted 7 years ago #

    Does wordpress support export of sidebar and its elements on different directory/page running some different script?

    yes it does, as long as you have properly included wp-blog-header.php

    the problem might also be that you are appear to be using your other script __off__ the subdomain that you hve WP on.

    I havent tested that theory, but you can. Try to do what you are doing within the same subdomain.

  11. coolbunny
    Member
    Posted 7 years ago #

    You cannot have 2 different scripts on same subdomain, cause both will have index.php file, and a folder can have only 1 file of same name.

    Plus, how can you say, that "wordpress support export of sidebar and its elements on different directory/page running some different script?" as a Yes ?

    I am mainly concerned about it working on different script, say for example you got joomla running on main domain and on subdomain wodpress, how will you import the sidebar to joomlas menu ? It works on simple .php page (not script page though).

    So anyone had success doing it?

    The best i could get at was this error " Fatal error: Call to a member function on a non-object in /home/user/public_html/blog/wp-includes/functions.php on line 1008 "

  12. coolbunny
    Member
    Posted 7 years ago #

    The best i could get at was this error " Fatal error: Call to a member function on a non-object in /home/user/public_html/blog/wp-includes/functions.php on line 1008 "

    System lagged, and caused me to double post :(

  13. whooami
    Member
    Posted 7 years ago #

    You cannot have 2 different scripts on same subdomain, cause both will have index.php file, and a folder can have only 1 file of same name.

    Im sorry -- you are telling me this? I already know this, but thanks.

    renaming your other scripts index.php for the purposes I suggested above solves that problem, for what its worth.

    As for this:

    Plus, how can you say, that "wordpress support export of sidebar and its elements on different directory/page running some different script?" as a Yes ?

    I say it by typing it.. its the letter Y, followed by the letter E, followed by the letter S.

    and you keep saying script and simple php as if they arent the same, and they are. PHP IS script.

    --

    You want the simple way to do what you are doing? You view the source on a page that has the sidebar on it, and you paste it into your "script".

    If you want more suggestions, please dont be smug.

    If you want more suggestions, please talk in absolutes instead of for instances. I dont care about a "for instance".

  14. coolbunny
    Member
    Posted 7 years ago #

    How about we say simple .php as no code other than the include code ? and other script as a fully coded working script using other files , just like wordpress. Now i wonder if i have 2 wordpress installs on different subdomains how will someone import sidebar from other subdomain ?

    So when you look at the word simple.php its not a fully coded dynamic php page, its just pure blank page with just the include and the sidebar code.

    Anyways how bout you actually try it, yourself and see for yourself ? If you got time, download phpld directory script from phplinkdirectory.com and install it on one subdomain, and install wordpress on other, and try to import the sidebar on your phpld script, than maybe you might be able to understand the whole situation better and will wait for you to reply "Y " followed be "E" and than "S".

  15. whooami
    Member
    Posted 7 years ago #

    If you got time, download phpld directory script from phplinkdirectory.com and install it on one subdomain, and install wordpress on other, and try to import the sidebar on your phpld script, than maybe you might be able to understand the whole situation better and will wait for you to reply "Y " followed be "E" and than "S".

    I would love to do that, however I'm not going to spend $25.00 for the script -- so thats not going to happen.

    I will show you this though ..

    http://pay.onewish.org.uk/ thats a default install of php coin, its a payment system written in PHP. Its MySQL driven.

    You will notice at the bottom of that page that there is something that looks like WordPress sidebar. It looks like one because thats exactly what it is. And its dynamically included on a subdomain that is different than the subdomain that the WordPress blog is on using 2 very simple lines of code:

    require('../you-get/wp-blog-header.php');
    get_sidebar();

    the blog, on another subdomain is over here:

    http://you-get.onewish.org.uk/

    As I previously stated, it can be done, its done all the time. Theres no magic.

    Now Ive also tested another theory where perhaps the mysql session isnt being closed properly so the database calls that your get_sidebar(); are making are to the other database.

    While I can move my sidebar around in this page and nothing breaks database-wise - that too might be your problem.

    You can doublecheck, experiment with that being the problem... that by forcing the mysql session for the phpld script to close before trying to call the sidebar bit. IF in fact, its not closing.

Topic Closed

This topic has been closed to new replies.

About this Topic