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

Viewing 15 replies - 1 through 15 (of 20 total)
  • Moderator James Huff

    (@macmanx)

    The Loop’s page has been recently updated:

    https://codex.www.ads-software.com/The_Loop

    Another similar resource was also added not too long ago:

    https://codex.www.ads-software.com/The_Loop_in_Action

    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?

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

    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.

    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.

    https://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.

    Thread Starter Abby

    (@abby)

    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.

    You can create a template called home.php and put the loop within that.
    https://codex.www.ads-software.com/Template_Hierarchy
    Perhaps this article will shed some light on what WP looks for in order when getting a template.

    Thread Starter Abby

    (@abby)

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

    Thread Starter Abby

    (@abby)

    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

    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.

    Thread Starter Abby

    (@abby)

    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.

    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…)

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

    Thread Starter Abby

    (@abby)

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

    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 https://somehost.com/yoursite/ , you can install WordPress in /yoursite/wordpress/ . Normally that would make for a really ugly url (https://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 https://yoursite.somehost.com/ and then the WordPress directory would be https://yoursite.somehost.com/wordpress/ .

    A link might be helpful.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘wordpress blog in iframe’ is closed to new replies.