WordPress.org

Ready to get started?Download WordPress

Forums

One and Two columns posts on the same page (13 posts)

  1. benzine
    Member
    Posted 3 years ago #

    Hi all

    Am new to WP and starting to learn this powerful application. My apprenticeship is going great but now I'm stuck with an issue concerning custom posts. What I want to achieve is to display multiple posts; 1 column post and 2 and 3 columns posts at the same time on the same page. I've google this term with no success. I also want to know how to create the script to know which type of post I'm creating such that it displays in the way I want it to appear on the page. I also want to have a title for each post.

    I found some helpful plugins for page/post columnist but this isn't what I want right now.

    Please see the image what I want to achieve to better understand my problem.

    http://www.infografixlab.com/deploy/screen.jpg

    Waiting for some feedback and a solution.

    thanks
    Ben

  2. Root
    Member
    Posted 3 years ago #

    The key to beginning to understand this is using the loop multiple times. Look in the Codex here. The loop has to be rewound so it can go again. Then u can put multiple instances on a page and wrap yr layout around them.

  3. benzine
    Member
    Posted 3 years ago #

    can you show me an example please :D, am still a novice and eager to learn that

  4. Root
    Member
    Posted 3 years ago #

    all the expo and examples are here

    http://codex.wordpress.org/The_Loop

  5. benzine
    Member
    Posted 3 years ago #

    thanks, i'll have a look and learn from this point and revert back if need be.

    Thank you for taking the time answering my question
    Ben

  6. Root
    Member
    Posted 3 years ago #

    For yr level of functionality you need to understand the loop and its variables. Its all there.

  7. cre8d
    Member
    Posted 3 years ago #

    Hi Ben,

    I tried emailing you after your contacted me through my blog but my Gmail emails are being bounced.

    The exact code will depend on your particular situation but the basic idea is to use multiple WordPress loops for the different areas of the page you're displaying content in and PHP "switch" code to alternate in the different columns.

    Rachel

  8. benzine
    Member
    Posted 3 years ago #

    Wow, hi Rachel how did you found me from nowhere :)

    Thanks indeed to channel me thru the right tunnel...I'll have a read on multiple loops as you both have suggested and hope to be able to help myself to solve this problem.

    Cheers
    Ben

  9. benzine
    Member
    Posted 3 years ago #

    Hey there

    Now I've read about the loop etc . I've succeeded to create custom post types noe and my main concern now is to publish this post on my homepage with a particular css. I read about how to query such post but I'm getting mingled. can yu help me please I'm testing the twentyten theme here http://test.infografixlab.com/

    My custom post type is here http://test.infografixlab.com/?page_id=22

    Please help me with the codes.

    thanks
    Ben

  10. benzine
    Member
    Posted 3 years ago #

    What I want to do is to have normal post as well as custom post types on the homepage or numerous custom post types as depicted here http://www.infografixlab.com/deploy/screen.jpg

    Please help me guys :))

  11. benzine
    Member
    Posted 3 years ago #

    <?php
    if( is_home() ){
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts( array('post_type'=>array( 'post', 'linkpost'),'paged'=>$paged ) );
    }
    ?>

    is that the correct code yo input in the index.php? Or shall I use a static homepage? How to do it with the various types of posts I've got (from my screenshot (http://www.infografixlab.com/deploy/screen.jpg)?

  12. benzine
    Member
    Posted 3 years ago #

    I figured it out now I need to get those custom posts styled on my homepage!

    Can you help me on this one pls?

  13. benzine
    Member
    Posted 3 years ago #

    Am using this piece of code to display my custom posts on the homepage

    add_filter( 'pre_get_posts', 'my_get_posts' );

    function my_get_posts( $query ) {

    if ( is_home() && false == $query->query_vars['suppress_filters'] )
    $query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );

    return $query;
    }

    When I use this piece of code in WP 3.03, it displays perfectly on the homepage. But when I’m assigning a page template for the custom post type to a page is displays all the custom posts like on the homepage. Is there a way to suppress that function allowing the display of selected custom posts only on the homepage while the other pages display only the assigned page template?

    Anyone

Topic Closed

This topic has been closed to new replies.

About this Topic