Wordpress' 'the loop' in context to adding blog features to static pages

bamme

Senior Member
Hi, im reading up on how to simply add a "blog" page to a static site, which would list posts.

I noticed on WP's documentation (http://codex.wordpress.org/Integrating_WordPress_with_Your_Website) this:

It is necessary to include The Loop in your pages to effectively take advantage of the multitude of Template Tags or plugins available. Familiarize yourself with The Loop and the basics of The Loop in Action to get underway with integrating the power of WordPress into your website.​
I have tried to search this but i get lost in the tutorials, for example this: http://www.themelab.com/2008/04/04/the-ultimate-guide-to-the-wordpress-loop/

it looks great but i can't find anything specific to how id need to get to know the loop and what about it i need to understand/include in web pages for this specific purpose; simply add a "blog" page to a static site, and potentially category sidebar.

i am conscious in future the blog will use plugins such as a facebook like button so i want to be able to know how to use the loop best in context to what im doing

has anyone got any useful resource links??

i realise i could just shove a blog in a subdirectory and just put a link from my site. however, alongside this, ive created a wordpress site here:
http://www.winninghealthsolutions.com/new

my developer friend has added a booking system he made in the sense of placing it in the same directory. heres the login interface:
http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php

kinda ugly. what i want to do is add bits and pieces from existing wordpress includes etc to make this look like the wordpress site. so really, i think i do need to know what this loop thing is all about to do this.

thanks!
 
Hi, I've only read the first sentence in your post about wanting to have a static wordpress site based on pages and having one of the pages as a blog section to display your posts. The rest of your post is quite technical when the solution to what you have asked is quite simple:

In your admin page, go to settings > reading. Select what you want your Front page (basically your homepage) to be, then choose what you want for your Posts page, which in your case will be blog, if that's what you called the page.

Thats it... Unless I have completely missed the point of your question...
 
bamme said:
i realise i could just shove a blog in a subdirectory and just put a link from my site.
This.



Or, from what I can tell, your static site should just be built up by using static WP pages, and then you can just include the Loop on your blog page. Then all of it would be in the same directory.
 
from what I can tell, your static site should just be built up by using static WP pages, and then you can just include the Loop on your blog page

this is a good shout and something i didnt think of.. im unsure as to whether this would work as im too unfamiliar with the php workings of that booking system, but what you're saying is that i should take the relevant code out of the existing login.php page which is static and not integrated via wp (http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php), and create a new page, within my wordpress admin panel, and paste it in there in code view and save this as the login.php page, rather than try to insert my wordpress pages'/posts' header and footer etc in and around the login.php file?
 
bamme said:
this is a good shout and something i didnt think of.. im unsure as to whether this would work as im too unfamiliar with the php workings of that booking system, but what you're saying is that i should take the relevant code out of the existing login.php page which is static and not integrated via wp (http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php), and create a new page, within my wordpress admin panel, and paste it in there in code view and save this as the login.php page, rather than try to insert my wordpress pages'/posts' header and footer etc in and around the login.php file?

Something like that. You seem to be good at overcomplicating your sentences :rolleyes: :p
 
Thanks :)

You seem to be good at overcomplicating your sentences

That is probably my most well-practiced, best and most unique skill. Its good for if you ever wanna wriggle out of anything.. you can talk so much people don't have a clue what you were trying to get out of in the first place

It's not good for exams with word count, explaining yourself, trying to help anyone else when they have a problem, or getting help with your own.. heh
 
Kevin said:
This.
Or, from what I can tell, your static site should just be built up by using static WP pages, and then you can just include the Loop on your blog page. Then all of it would be in the same directory.

You dont need to write or modify any php or even know what the loop is to do this.
 
You dont need to write or modify any php or even know what the loop is to do this.

Thanks for clarification richimgd and this is something i like the sound of. haha, can i ask in this case:

your static site should just be built up by using static WP pages, and then you can just include the Loop on your blog page.

can i just also clarify that you second Kevin's idea; just taking the relevant php code out of login.php, and all other booking.php files which provide the 'visuals', and placing them into new wordpress Pages created via my admin panel (pasting into code view of wysiwyg editor)
 
(to clarify, my task is basically to make that login system look like it's corresponding website's pages as much as possible. the websites pages are wordpress pages. to have a look around these login details have been set up: user [email protected], pass: cobblers - however if you do use those details and look around please dont book anything as its connected to my friend's gym's live database.)

the site is here

http://www.winninghealthsolutions.com/new

the login interface of the booking system (or how to get into it) is here
http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php
 
bamme said:
can i just also clarify that you second Kevin's idea; just taking the relevant php code out of login.php, and all other booking.php files which provide the 'visuals', and placing them into new wordpress Pages created via my admin panel (pasting into code view of wysiwyg editor)

I second kevins idea about building the site out of static pages and then using the blog page to display your post as this is what I originally said on my first reply. I kept it very simple as to do this is a very simple task and doesn't require using php or knowing what the loop is as it is all done via wordpress admin. Of course you can easily get technical by getting involved with the loop...

I dont know what login.php is or booking.php... this is a different issue from your first question. I logged in but it gets a 404 error message as it cant find member_login.php which it is looking for inside the booking directory:
http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/booking/member_login.php
 
ah - sorry. this bit was unclear. i should have detached this part from the original question, both questions are here because i presumed they both related to the loop:

i realise i could just shove a blog in a subdirectory and just put a link from my site. however, alongside this, ive created a wordpress site here:
http://www.winninghealthsolutions.com/new

my developer friend has added a booking system he made in the sense of placing it in the same directory. heres the login interface:
http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php

kinda ugly. what i want to do is add bits and pieces from existing wordpress includes etc to make this look like the wordpress site. so really, i think i do need to know what this loop thing is all about to do this.
this is the question im referring to, sorry, not the first one. if im right, i now am starting to think i dont need the loop at all for this question, as the loop is the thing used to do things like list posts.

so my reply to kevins comment, which was this:

this is a good shout and something i didnt think of.. im unsure as to whether this would work as im too unfamiliar with the php workings of that booking system, but what you're saying is that i should take the relevant code out of the existing login.php page which is static and not integrated via wp (http://www.winninghealthsolutions.co.uk/new/wp-content/themes/supercms/login.php), and create a new page, within my wordpress admin panel, and paste it in there in code view and save this as the login.php page, rather than try to insert my wordpress pages'/posts' header and footer etc in and around the login.php file?
also related to the second question, quoted above in this reply.
 
So this booking system has been setup completely outside wordpress by your developer friend? So its not a wordpress plugin or anything?

I am not a php guru and dont know how this booking system works, but what you could potentiolly do is add it into a theme template. Depending on what theme you use, when you create a page in wordpress can you choose a template to assign to it? I know you can in the default twentyten wordpress theme. Locate a template file eg onecolumn-page.php (this is in the twentyten theme - probably not the same if you use a different theme), then save as a new name eg bookingtemplate.php. Inside this file notice at the top of the file it says
* Template Name: One column, no sidebar
change this to something like
* Template Name: booking template
It is inside this file that you need to add your booking system code and link to any other files it requires. It might be that you need to mainually add in your header instead of adding it dynamically as an include since you will probably need new things in your header such as booking system speciffic stylesheets or any other files the booking system needs linking to from the header.

Once you have got this page sorted you can create a page called 'Booking' inside your wordpress admin, then choose the 'booking template' template you have just created. Then when uploaded your booking page will currently exist on http://www.winninghealthsolutions.co.uk/new/booking much nicer!

You will need to be confident with HTML and have a working knowledge of PHP to do this. If this sounds like too much work try and look for a booking system plugin as that might be easier to integrate with the site without getting involved with the code as much.
 
You know what i actually understand this, and it makes lots of sense, thank you very much :) my friend who made the booking system will probably be better at trying this than me as he understands php whilst i clearly dont. heh but ill look at the code and maybe even try on a test page as i have the 'stripped down' version of the login.php file to look at i guess.

or maybe i will read this book i bought about developing for wordpress. heh.

thanks people
 
Yea have a go at it, just make sure you don't overwrite a template your already using for something else, duplicate it first and re-save it, then if it doesn't work at least you wont screw up other parts of the site ;-)
If you're already working with someone who is a php developer he will probably be able to sort it out.
Good luck!
 
Hi people, I'm bamme's php developer friend.
Just thought of an infinitely simpler approach. Create a new page in the existing template which contains an iframe whose source is the login.php file. The rest of the booking system will then run in the iframe inside the theme.

Member Login - Winning Health Solutions
 
Fair enough that's a quick way of doing it.. didn't think of that. You will obviously loose browser back button functionality within the iframe this way but not sure if that is important. Are you putting the iframe inside the template or are you putting it in via the wordpress admin?
 
It's a bit of a cheat, I suppose, but it's an easy way round a lot of problems.

The iFrame is in a new page created in Wordpress admin. This page becomes a frame for the whole booking system. Yes, you do lose back and forward browser button functionality, but I think that is acceptable (it happens in online banking etc.) I could always add back and forward buttons on the booking pages in addition to the existing navigation.
 
hi richard! haha im glad i didnt post the thread "any obvious problems with putting this in an iframe??" looks like you sorted it. i see no problems here either as we've no need to do anything with SEO for this, and we can provide a link for people who's browsers don't support, to the external standalone page. (just for closure/to spark further discussion here rather than leave it blank!)
 
Back
Top