WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Putting WP into my existing pages. (19 posts)

  1. eagle1296
    Member
    Posted 9 years ago #

    Yes, I've read other topics. No, I don't know how to make it work. ;-;

    (Summary at bottom of post)

    Honestly, I've tried reading, but I need someone to show me how better than just telling. "USE THE LOOP" is not an explanation that I can use. I've tried to find that "Don't remove" or whatever I read in another topic, but that still confused me and didn't do anything. Basically, on my website, http://www.andycan.net, I want to have my WP entries appear where my "New and Updates" currently are. I'm not a master of the internet by any stretch, I've just got enough understanding of html and css to make my own website interesting to look at for me. At that, I've had a bunch of people who apparently feel high and mighty complain about my site. But, I never really asked for an opinion on it, just help with it. They didn't even contribute anything of value, just whined. But I digress.

    In summary, I need help integrating WP into my "news and updates" section on my main page. I've read other topics and spent quite a bit of time not understanding what to put and where to put it to get all this together. If someone could physically SHOW me, I would be eternally grateful.

  2. Try reading through this Codex article, it's relatively new: http://codex.wordpress.org/The_Loop_in_Action

    This may help as well: http://www.jonathanwold.com/tutorials/wordpress_integration

  3. Dgold
    Member
    Posted 9 years ago #

    I'm no expert either, Andy, but it seems to me you should just make your whole site in Word Press rather than integrating The Loop into your existing HTML. You could use your current banner, background, and I believe you could use or duplicate all your CSS. You can make Pages and Categories in WP to split up your sections and create navigation that looks just like you have now. The bonus would be managing everything within WP.

    That second link to jonathanwold-wordpress integration, gets handed out a lot. I read it, and it didn't help me a bit. It seemed to be talking about something different, and was based on the premise that your site was already built in PHP and CSS. Most people asking to "intergrate" just want to plop WP content into an old HTML page, and my finding so far is that isn't a good route. Better to start over in WP Themes and mimic your old design.

  4. eagle1296
    Member
    Posted 9 years ago #

    Yeah, I learn by being shown, not just someone saying, "LOOP LOOP LOOP" or something like that. I read through that second page too, but it had no help for me at all. So, you feel like making WP into my site would be better? And, how would that work, exactly? Take the index.php and stick my index.html into it?

  5. moshu
    Member
    Posted 9 years ago #

    Actually both ways work, depending on what exactly you want to achieve.
    @eagle, if you just want "to have my WP entries appear where my "New and Updates" currently are" - that's the easy part. The complications will come when they click on a title or comment link and they will be taken to a blogsite that doesn't look like your site.

    If you want your blog index to llok like your site's main page now, you can just open your index.html and one of the themes' index.php (I strongly recommend NOT use use the deafult, but the classic!) and take the bits from the blogindex and copy over to your index. At the end you'll have to save it as a php file.
    Also be aware that the theme's index.php is "cut" up in several pieces! see here

  6. eagle1296
    Member
    Posted 9 years ago #

    I actually don't care much about whether the blog looks like my site, at the moment, anyway. I'm just concerned with writing entries and having them appear in my index.html. However, your plan does interest and confuse me. A little more in depth explanation would be helpful. Basically, am I just supposed to take out random parts and put them into my index? @_@

  7. moshu
    Member
    Posted 9 years ago #

    Before we start: where is your WP installation? In a directory or in the root? I can see an index.php in the root (with some errors).

  8. eagle1296
    Member
    Posted 9 years ago #

    okay, my site is http://www.andycan.net

    wordpress is in http://www.andycan.net/blog

    In the end, I'd like to have http://www.andycan.net remain my main page for my site.

  9. moshu
    Member
    Posted 9 years ago #

    OK, here is a quick and "dirty" solution for your website. Maybe I'll write up a full tutorial on this later, but for now the essential steps for you.
    1. Delete the index.php what you have now at the root of your site (the one showing the errors)
    2. Open your index.html (the main page) and the index.php from the classic theme (wp-content/themes/classic/index.php)
    3. A little bit of code reading:
    - you have "contentcontent" div with manually updated news
    - you want to replace it with the 'content' part of the WP, basically with The Loop
    - even if you are reluctant, you have to take a look at it; it starts here:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    ...
    and this is the end of it:
    <?php endif; ?>
    - in between, even if you are like me, i.e. not knowing anything about PHP, you can see a lot of template tags with pretty much intuitive names, like: the_date; the_permalink; the_title; the_content; the_category etc.

    4. Save your index.html as index.php (do I need to say backup everything?)
    5. Now we'll edit this new index.php file:
    - in the "content" div you have 3 elements:
    <div id="contenttop">
    <span class="updateinfo">
    <p class="updatecontent">
    - clean it up, leave only ONE instance of these elements, and delete the text from them
    - WP is going to put p tags around the posts, so let's change the last element into div class="updatecontent">
    important! at the very top of the file, before anything put these lines:
    <?php
    require('./blog/wp-blog-header.php');
    ?>

    /blog/ is necessary because your WP installation is in that directory under the root, right?
    6. "Importing" stuff from WP's classic index:

    - Copy/paste the beginning of the Loop right under your "contenttop" div, like this:
    <div id="contenttop">News and Updates</div>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    - Next in WP is the_date tag, copy/paste into your span for time:
    <span class="updateinfo"><?php the_date('','<h2>','</h2>'); ?></span>
    (or use the_time, whichever fits you, more reading in Codex > Template tags)

    - Copy the remaning part of the Loop starting from:
    <div class="post">.....
    down till
    <?php endif; ?>
    into your <div class="updatecontent">

    - Save your index.php file and upload it to your root. The rest is working a bit with the css file to make everything look neat.
    Enjoy! :)

  10. eagle1296
    Member
    Posted 9 years ago #

    where does "the loop" go? Does it go where I put my updates and such, or does it comletely go over my "contentcontent" div? I just want to make sure I put it in the right place.

  11. moshu
    Member
    Posted 9 years ago #

    Man <sigh> - and I thought I was clear :)
    http://paste.uni.cc/7278

  12. eagle1296
    Member
    Posted 9 years ago #

    Nevermind ;X

  13. eagle1296
    Member
    Posted 9 years ago #

    Sorry, I just was only at that step, and I didn't want to go on for fear of losing my mind, but I found it. That was very helpful. Thanks! :D

  14. moshu
    Member
    Posted 9 years ago #

    Let me know if it works.

  15. eagle1296
    Member
    Posted 9 years ago #

    The only other thing I wanted to know, is how many posts will appear on the main page? I only want 5 or so to appear at maximum there. Can I make a whole seperate page like, "www.andycan.net/blog.php" for the rest of my entries or something?

  16. eagle1296
    Member
    Posted 9 years ago #

    Oh, and this thing will be looking at my style sheet, not the one it has, right? So I'll have to adjust my sheet to fit and CSS they have in the PHP?

  17. moshu
    Member
    Posted 9 years ago #

    Slow down :)
    1. There will be as many posts on the main page as you define in your admin panel > Options > Reading (unless you use a customized query instead of the Loop)
    2. For now if you click on any of the links (like title of posts, comments) it will take you to the blog that is installed. I warned you earlier that the blog will NOT look like your site...
    3. This "thing" is a copy of your actual index.html, so, yes, it is looking at your stylesheet.
    4. Making your whole blog to look like the rest of your site --- well, it's another tutorial's topic :)

  18. eagle1296
    Member
    Posted 9 years ago #

    lol. Alright. I'm okay with it looking different for now. I'll work on it later. Time to go to work. >_<

    Thanks for all the help!

  19. brbreslin
    Member
    Posted 9 years ago #

    This was very useful, now is it possible to have it instead of pull the content of the post, just the first x words?

Topic Closed

This topic has been closed to new replies.

About this Topic