WordPress.org

Ready to get started?Download WordPress

Forums

How do I create complex layouts? (12 posts)

  1. orourkedd
    Member
    Posted 2 years ago #

    I'm trying to learn WordPress best practices.

    I've noticed several wordpress sites with complex layouts and am wondering how its done. For example, take a look at the homepage for http://www.gravityforms.com. I can only think of two ways this homepage is created:

    1) Hard code it all into a template.
    2) Paste A LOT of HTML under the HTML tab while editing the page.

    Neither other these seem good to me, so I'm turing to the community to see what you guys do.

    Thanks!

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    All of that site's home page could be coded using PHP, HTML, widgets,. plugins or all 4.

  3. orourkedd
    Member
    Posted 2 years ago #

    I can code it up in a template with HTML and PHP no problem. Should various pieces of content (for example the "Packed With Features.. Gravity Forms Really Satisfies" section) be put into a widget so it can be easily moved around?

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    It depends on the plugin really. Some (like Contact Form 7) will work in a widget out of the box, others require a little more PHP knowledge to call the right functions and the last group just won't work outside of the Post or Page content.

    I assume you're au fait with multiple Loops too?

  5. orourkedd
    Member
    Posted 2 years ago #

    I guess what I'm trying to figure out is where all of the HTML on that page comes from? There are several distinct sections stacked on top of each other. Are they...
    ...just all pasted into the page editor as HTML?
    ...a loop of posts that are used to render the page?
    ...something else like widgets, etc?

    Thanks for working with me on this!

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    That's a bit like asking how long is a piece of string. Without actually seeing the relevant template file, we can't really say for sure what approach was used. Yes - it could all pasted into the page editor as HTML but I'm betting that's it's something a little more sophisticated such as multiple Loops and/or custom widgets.

  7. orourkedd
    Member
    Posted 2 years ago #

    Thanks Esmi!

  8. gladwda
    Member
    Posted 2 years ago #

    It's likely to all be in index.php. And bits they want to dynamically change the text of they'll just call a post into a div - and style that div in the style.css file.

    This really is a "how long is a piece of string" question. Rather than asking something so vague, ask how you would do something specific. Or if you have no idea about any of it. Perhaps you're starting a bit too high? You need to learn to walk before you can run dude.

  9. orourkedd
    Member
    Posted 2 years ago #

    Perhaps a better question is:

    How do I call in a specific post?

    This seems good, except now my data and its presentation inseparably linked (if this is in a template):

    <?php

    $post_id = 5;
    $queried_post = get_post($post_id);

    ?>

  10. gladwda
    Member
    Posted 2 years ago #

    Couple of options here.

    A plugin will do it. Alternatively hard coding as you've suggested.

    However you can just create a unique page template and paste that in. And only use that page template for that page.

  11. Digital Raindrops
    Member
    Posted 2 years ago #

    I'm trying to learn WordPress best practices.

    You will not learn by trying to build a Ferrari as a first project.

    Small is better, start with a starter theme like a twenty eleven child theme.

    Find tutorials that change the default theme, then learn how to code and style WordPress, take time and learn, download themes that have some of the features you want and copy the code snipits and styles across.

    Once you have learnt a bit then plan your own theme, draw it out on paper, decide what can be done with a widget and what you need to code.

    Build your theme in small steps, as you complete each step it will feel good, try not to build the whole site in one go it is likely never to be finished.

    Understanding the template hierarchy and the WordPress Codex is also important.

    Who knows in six months you might be back showing us your Ferrari!

    I have a few child themes that have little changes, these might get you started, as a child theme only has the changes and not all files!

    This code an answer for another toipc here, is an example of muliple loops.
    http://pastebin.com/rCWj69c2

    HTH

    David

  12. esmi
    Forum Moderator
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags