Forums

Give help. Get help.

  • # December 1, 2008 at 3:23 pm

    Hi Guys,

    So this is the structure I want to go with for my site, chadwik.us.

    I need my page to be structured as follows:

    Home – (Static Page that has recent articles from my blog page posted on it)

    My Work – (Uses the loop to grab articles about recent projects that I have done)

    My Services – (Uses page.php)

    Blog – (Uses the loop to grab articles that everything but what is in My Work)

    Contact – (Uses a special_template.php so I can include forms).

    I have been successful up to the pages that I want to use the loop on.

    What is the best way of going about this? So far I have tried creating special_templates that has the loop code in them for the two pages that I need to use it on. The problem I am seeing is that it is recognizing that it is a page and using both page.php and the special_template. How do I get this to work without having my url’s something like chadwick.us/categories/blog. You can see I am currently trying to query in certain categories but it is doing something weird and list all the posts at the top and what ever is in those posts at the bottom. Any help would be awesome.

    Thanks

    # December 1, 2008 at 7:46 pm

    Thanks Chris,

    I also found this to work too which gets around the whole long URL (Or at least that’s the way I got it to work).

    Create a page called Blog or any page that you want to use the loop on. Create a new .php template and use it on that page with this code in it. I am now looking at the posts through Firebug to style them accordingly

    Code:
    < ?php /* Template Name: BlogPage */ ?>

    < ?php get_header(); ?>

    < ?php query_posts('category_name=article_test&showposts=10'); ?>

    < ?php $posts = get_posts('category_name=article_test'); foreach ($posts as $post) : start_wp(); ?>

    < ?php the_content(); ?>

    < ?php the_title(); ?>

    < ?php endforeach; ?>

    < ?php get_sidebar(); ?>

    < ?php get_footer(); ?>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag