• Resolved fire-enigmax

    (@fire-enigmax)


    I know that this is probably something simple but after ages of looking I still am at a loss.

    I have designed a site layout and I now want to push this into a WP Theme. My problem is that I want to call and display certain posts by their ID.

    Basically I dont think (if i can someone tell me how) that I can style my page how I want using the standard loop. As I have split my page into many div tags to create a sort of grid layout.

    What I want to achieve is something like(only more complex):

    <div id=rhs>
    <div id=”post-<?php post_id ?>”>
    <?php call_post(1) ?>
    </div> <!– close post div –>

    <div id=”post-<?php post_id ?>”>
    <?php call_post(2) ?>
    </div> <!– close post div –>
    </div><! close rhs div –>

    <div id=rhs>
    <div id=”post-<?php post_id ?>”>
    <?php call_post(3) ?>
    </div> <!– close post div –>

    <div id=”post-<?php post_id ?>”>
    <?php call_post(4) ?>
    </div> <!– close post div –>
    </div><! close rhs div –>

    I realise that my syntax is incorrect (someone feel free to correct this)

    This is a basic overview of what I want to achieve– IS THIS POSSIBLE?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fire-enigmax

    (@fire-enigmax)

    Thanks for your reply, That plug-in looks perfect.

    For everyone elses benefit I have found another solution within the WP Docs (complete luck hehe)..

    Location: https://codex.www.ads-software.com/Template_Tags/query_posts

    Solution:

    <?php
    // retrieve one post with an ID of 5
    query_posts('p=5');
    ?>

    Which would be used as below:

    <?php
    // retrieve one post with an ID of 5
    query_posts('p=5');
    
    global $more;
    // set $more to 0 in order to only get the first part of the post
    $more = 0; 
    
    // the Loop
    while (have_posts()) : the_post();
      // the content of the post
      the_content('Read the full post ?');
    endwhile;
    ?>

    Thanks for the reply James, I was starting to wonder about the formums as things seem to be a bit slow for any previous questions! maybe everyone is on holiday?

    Anyway, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Calling Particular Posts’ is closed to new replies.