• Resolved eagle1296

    (@eagle1296)


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

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

    (@macmanx)

    Try reading through this Codex article, it’s relatively new: https://codex.www.ads-software.com/The_Loop_in_Action

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

    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.

    Thread Starter eagle1296

    (@eagle1296)

    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?

    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

    Thread Starter eagle1296

    (@eagle1296)

    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? @_@

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

    Thread Starter eagle1296

    (@eagle1296)

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

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

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

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

    Thread Starter eagle1296

    (@eagle1296)

    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.

    Man <sigh> – and I thought I was clear ??
    https://paste.uni.cc/7278

    Thread Starter eagle1296

    (@eagle1296)

    Nevermind ;X

    Thread Starter eagle1296

    (@eagle1296)

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

    Let me know if it works.

    Thread Starter eagle1296

    (@eagle1296)

    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?

    Thread Starter eagle1296

    (@eagle1296)

    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?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Putting WP into my existing pages.’ is closed to new replies.