Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Is all this possible in Wordpress

Options
  • 04-08-2009 3:29pm
    #1
    Registered Users Posts: 1,784 ✭✭✭


    Hey all,

    I'm in the process of updating my Blog/portfolio and I would like to know what my limitations are. I'm aware that WP is powerful but I have limited knowledge of PHP so I'm not sure if I can do all I'm listing here.

    5 Pages

    1) Home
    -Displays 2 of the latest posts from the blog
    -Displays 2 of the latest portfolio pieces

    2) Blog
    -Standard enough affair, that's pretty much sorted.

    3) Portfolio -
    Each of these items pull the latest post from the list of content.
    -Web
    -Displays all the Web related posts or items.
    -Print
    -Displays all the Print related posts or items.
    -Video
    -Displays all the Video related posts or items.
    -Photography
    -Displays all the Photography related posts or items.
    -Other
    -Displays all the Other related posts or items.

    4) About
    -Again, standard affair

    5) Contact
    -Again, it's sorted.

    I think what I'm trying to do here is have pages with posts in them. I'm aware that you can have nested pages but can you have dynamic content on these pages or is it always static.

    Maybe I could post all the web, video, photography etc, in catagories in the blog. Then, in the blog, don't display the content from these catagories. In the Web, etc. pages, pull out the content from the catagories unused by the blog.

    Any help is appreciated. I may be biting off more than I can chew but it's a learning process anyway, so that's what it's all about.
    Tagged:


Comments

  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    It's all possible (and you can have lists of posts on a page.. though you'll have to get your hands dirty with PHP).

    If you use categories, you can manage the rest of it. For the Blog page you'll have to exclude some categories (if you want), and will need to get hands dirty with PHP there again. There's good documentation on the WordPress Codex site for how to do that included/exclude category stuff.


  • Registered Users Posts: 213 ✭✭Hoku


    From the looks of it, 6 categories are all you need:
    -Blog
    -One for each portfolio sub-category

    Here's an example of how to show posts from a particular category:

    [PHP]<?php query_posts('showposts=6&cat=35')?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class="post">
    <div class="post-image">
    <?php $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image"); ?>
    <?php if($files) : ?>
    <?php
    $keys = array_keys($files);
    $num=$keys[0];
    $thumb=wp_get_attachment_thumb_url($num);
    ?>
    <a href="<?php get_permalink(); ?>" title=""><img src="<?php echo $thumb; ?>" width="80" height="80" alt="" /></a>
    <?php else : ?>
    <a href="<?php get_permalink(); ?>" title=""><img src="<?php bloginfo('template_url'); ?>/images/placeholder.png" width="80" height="80" alt="" /></a>
    <?php endif; ?>
    </div>

    <div class="post-content">
    <h2>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_title(); ?>
    </a>
    </h2>
    <?php the_excerpt('Continue reading »'); ?>
    </div>
    </div>

    <?php endwhile; ?>
    <?php endif; ?>[/PHP]

    So what exactly does this do....?
    *The first line looks to the WP database, and retrieves 6 posts from category ID 35.
    *The second line checks that there are posts to show from the previous query
    *The third line tells WP what to do with each of the posts that it just retrieved, if there are any.

    The rest of the code is just closing off the IF and WHILE statements, and of course, the layout of the post.

    This particular layout makes a 2-column post. A narrow left column holds the image obtained from the post's content, and the right column contains the title and excerpt of the post.

    Because natively Wordpress doesn't allow execution of PHP on its pages, this would be done through template files.

    Questions? :P


  • Registered Users Posts: 2,119 ✭✭✭p


    How much HTML/CSS experience have you got?

    If you' haven't got much then i'd recommend using a hosted portfolio service like cargocollective.com and then just linking that to a wordpress blog.

    If you've a bit more experience then indexhibit is a really nice free portfolio PHP script you can install on your own server.


  • Registered Users Posts: 1,784 ✭✭✭im...LOST


    p wrote: »
    How much HTML/CSS experience have you got?

    If you' haven't got much then i'd recommend using a hosted portfolio service like cargocollective.com and then just linking that to a wordpress blog.

    If you've a bit more experience then indexhibit is a really nice free portfolio PHP script you can install on your own server.

    To be completely honest, I don't have all that much but that's the point for me. It's a bit of a challenge and it's all part of the learning curve.

    Thanks for all the help lads.


  • Registered Users Posts: 1,784 ✭✭✭im...LOST


    Hoku wrote: »
    From the looks of it, 6 categories are all you need:
    -Blog
    -One for each portfolio sub-category

    Here's an example of how to show posts from a particular category:

    [PHP]<?php query_posts('showposts=6&cat=35')?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class="post">
    <div class="post-image">
    <?php $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image"); ?>
    <?php if($files) : ?>
    <?php
    $keys = array_keys($files);
    $num=$keys[0];
    $thumb=wp_get_attachment_thumb_url($num);
    ?>
    <a href="<?php get_permalink(); ?>" title=""><img src="<?php echo $thumb; ?>" width="80" height="80" alt="" /></a>
    <?php else : ?>
    <a href="<?php get_permalink(); ?>" title=""><img src="<?php bloginfo('template_url'); ?>/images/placeholder.png" width="80" height="80" alt="" /></a>
    <?php endif; ?>
    </div>

    <div class="post-content">
    <h2>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_title(); ?>
    </a>
    </h2>
    <?php the_excerpt('Continue reading »'); ?>
    </div>
    </div>

    <?php endwhile; ?>
    <?php endif; ?>[/PHP]

    Fantastic. Just did a bit of a switcheroo with the code and it all works perfectly but I'm just a bit unsure on how the image is retrieved from the post.
    Will I try and get work out some code to replace
    <img src="<?php bloginfo('template_url'); ?>/images/placeholder.png" width="80" height="80" alt="" />
    so that it pulls the first image no matter what or is there someway easier?

    I've commented it a bit for myself so I know what's what in the future but thanks again Hoku :)


  • Advertisement
Advertisement