WordPress.org

Ready to get started?Download WordPress

Forums

wordpress blog in iframe (21 posts)

  1. Abby
    Member
    Posted 9 years ago #

    First of all, can I just say so that nobody have to lecture me about it, I know search engines ignore iframes and they are totally impractical. But I don't care, I still want one. So sue me.

    You see, what I have is index.php which has my main layout thing on, and I want the blog INSIDE the iframe which is on index.php. Has anybody got any idea how I would do this?

    I've asked this before I believe, but all I got was a link to "The Loop". And I tried this but it didn't work, and I can't quite figure out how it's supposed to work.

    Any help?

  2. The Loop's page has been recently updated:

    http://codex.wordpress.org/The_Loop

    Another similar resource was also added not too long ago:

    http://codex.wordpress.org/The_Loop_in_Action

  3. Firas
    Member
    Posted 9 years ago #

    You don't want an iframe. iframes embed an external page inside another. You want overflow: scroll.

    Which option you choose depends on the context--is this main layout index.php generated by WP?

  4. tomhanna
    Member
    Posted 9 years ago #

    <IFRAME SRC="theurlofyourblog" TITLE="My Blog">
    <!-- Alternate content for non-supporting browsers -->
    Sorry, your browser doesn't support iframes

    You can still see my blog <a href="theurlofyourblog">here. </a>

    </IFRAME>

    The Loop has nothing to do with it.

  5. Michael Bishop

    Posted 9 years ago #

    pardon me for butting in, but if you simply want the posts in an iframe within another page, then yes, the loop would be the better option. If you want the entire blog (header, sidebar, main content, etc), then tomhana's post is correct.
    *Edit, to be more clear, if you simply want the content within the iframe, and not the entire blog, you would need to create a templeate USING the loop to simply show the posts, and not the entire blog, but then still use tomhana's example, simply replacing "urlofyourblog" with url of the custom php file containing the loop.

  6. tomhanna
    Member
    Posted 9 years ago #

    Abby,

    I cobbled together a very unimpressive theme to do this since it seems like an every other day question. White background with black and greyish letters. Easy to modify and 350 pixels wide with the basic meta information at the bottom. The only 'improvement' over the existing one column themes is that it's so narrow.

    http://www.tom-hanna.org/?p=794

    You may find it useful or it may give you an idea what you want to do. It does validate, so it has that going for it.

  7. Abby
    Member
    Posted 9 years ago #

    okay, thanks for the help but I've gotten nowhere. I guess I'm going to have to explain myself more clearly.

    what I have is a layout that I've made myself which is made with IFrames. now this would be index.php. there are two pages here: the index.php page that has the actual layout on, and then the blog page which would be in the iframe but have to follow the style of the rest of the layout. so that would probably have to be a theme in itself, but the problem is, that would want to be index.php too. now how would I get that to be the page inside the iframe?

    yes, I know how to use iframes. I know I would put the blogurl in the SRC bit of the iframe code, but if the blog AND the layout page are both called index.php, that wouldn't work. therefore, using the code

    <IFRAME SRC="theurlofyourblog" TITLE="My Blog">
    </IFRAME>

    wouldn't work, because it would look like this:

    index.php:
    <IFRAME SRC="index.php" TITLE="My Blog">
    </IFRAME>

    ...and you'd probably end up with a LOT of iframes.

    so if I need to use "the Loop" for this, can somebody please explain what I have to do? because I have no idea what it wants me to do and when I have tried, it hasn't worked. all I want is my blog (posts - I wouldn't have any other things) in the style of the rest of the layout inside my layout on index.php.

  8. Michael Bishop

    Posted 9 years ago #

    You can create a template called home.php and put the loop within that.
    http://codex.wordpress.org/Template_Hierarchy
    Perhaps this article will shed some light on what WP looks for in order when getting a template.

  9. Abby
    Member
    Posted 9 years ago #

    but wordpress sees index.php as the homepage for the blog, doesn't it? so how can I get my blog on home.php?

  10. Abby
    Member
    Posted 9 years ago #

    also, when I do try to do something, I get this problem:

    Fatal error: Call to undefined function: wp_get_archives() in /home/.../blog.php on line 5

  11. Michael Bishop

    Posted 9 years ago #

    It's my understanding, that if you create a template file called home.php, that WP actually looks for that BEFORE it looks for the template index.php. So technically, you could rename the index.php file to home.php, and WP would have no trouble using that template to create your blog.
    This thread has some more discussion on the subject. Also, I really suggest reading through the codex some more if you haven't already, there's a ton of info on creating the templates and their various functions.

  12. Abby
    Member
    Posted 9 years ago #

    okay, so now I have index.php with my layout, and supposedly home.php with my blog on it. only problem now is that when I go to index.php it takes me to home.php. so now I only have what should be IN the iframe on my layout page.

  13. Michael Bishop

    Posted 9 years ago #

    This may be more than I can assist with. I do know there is an option to have your WP install in another area than the mainpage, perhaps look into that, so that your primary index.php is what loads first, then the WP home.php loads second. Outside of that, I have to defer to someone with more knowledge than I. I have only really seen others using the loop/iframe option within a static .html page, not another dynamic one. (And I must say, I don't really understand that part, but you asked not to be questioned on that end of it...)

  14. tomhanna
    Member
    Posted 9 years ago #

    Install WordPress in a subdirectory called, for example, "wordpress". Then put /wordpress/index.php in the src of your IFRAME.

  15. Abby
    Member
    Posted 9 years ago #

    Okay, but how can I do this if my website is in a directory? Because it is...

  16. tomhanna
    Member
    Posted 9 years ago #

    Hopefully I'm understanding your question correctly. With most hosts, if you have FTP access (and I can't imagine installing WordPress without FTP access) you can create a subdirectory under your main one.

    For example, if your main site is http://somehost.com/yoursite/ , you can install WordPress in /yoursite/wordpress/ . Normally that would make for a really ugly url (http://somehost.com/yoursite/wordpress/) but you aren't actually going to be sending people to that URL anyway. If you're using a subdomain, generally speaking, you can still do this, so the url might be http://yoursite.somehost.com/ and then the WordPress directory would be http://yoursite.somehost.com/wordpress/ .

    A link might be helpful.

  17. Abby
    Member
    Posted 9 years ago #

    okay, I've done that. now my wordpress is part of my website, but now I have a problem. I used your "Ultrasimple" theme as a base for my theme, changing it to suit my layout, but now I have a problem. for some reason, the scrollbar CSS isn't showing up, and I can't get the text to fit in my iframe: it goes over. I've tried using a div to make it smaller, which has absolutely no effect, so I've tried using CSS and a div by using a "class", but it's still not working. the URL is http://mouse.arab-quest.net and click on "Journal" to see the wordpress. can you see the problem? any suggestions on fixing it?

  18. Michael Bishop

    Posted 9 years ago #

    Looks fine(the frame that is) in FF 1.0.4/mac.

  19. Abby
    Member
    Posted 9 years ago #

    no...it should fit the iframe completely without a horizontal scrollbar. and the scrollbar should be black...AND the text should be justified. none of which are actually happening. but you can't see it now because my site's gone down for some reason..

  20. pinacleo
    Member
    Posted 8 years ago #

    Could some (very patient) one explain to me how I would go about using the 'overflow:scroll' element to box my posts only?

  21. pinacleo
    Member
    Posted 8 years ago #

    I figured it out. It feels good to be iframe free!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags