WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Is this design feasible?

[Resolved] Is this design feasible?

Viewing 15 replies - 1 through 15 (of 30 total)
  • esmi

    @esmi

    Forum Moderator

    Depends what you mean by “easily”. I’d suggest starting with Theme_Development

    Thanks, I read abot themes, and ive made my own, im more wondering if where to find how to code this. is it possible to have links to posts that open in the same template but are not permalinks, for example?

    esmi

    @esmi

    Forum Moderator

    Sorry – not sure I follow. A link to any post within WP is a permalink, so what sort of links do you mean?

    You might want to review Template Hierarchy and if you are saying you don’t like a post’s single view to be handled via single.php then look at several plugins that allow ‘template specification per post’.

    http://wordpress.org/extend/plugins/single-post-template/
    http://wordpress.org/extend/plugins/custom-post-template/

    Is something like this what you want?

    For the left panel, list your Article titles with the links pointing back to this page, but with an added parameter of the post ID of the article: http://mysite.com/articlespage/?myarticleid=44

    Then in the right panel, use $_GET['myarticleid'] to find the article to display in that panel.

    Thank you all.
    esmi: The permalinks use the index page template (or if i get around to it, the ‘single’ template. I wanted the links to open in the same view in which the links are.

    MichaelH:Thanks for the links.

    vtxyzzy: That sounds exactly like how i would want it to work. (although I would like for the left panel links to show up there automatically as i post in that category, rather than having to manually write the links) Do you know of a place where I could see examples of such a code?

    I was thinking something like:
    In the left field:

    <?php
    
        $lastposts = get_posts('numberposts=1&category=15');
    
    foreach($lastposts as $post) {
        setup_postdata($post);
        the_date(ymd);  the_title(); the_meta();
    }
    ?>

    And then in the right field:

    <?php
           $lastposts = get_posts('numberposts=1&category=15');
    
    foreach($lastposts as $post) {
        setup_postdata($post);
        the_title(); the_date();
    	the_content();
    }
    
    ?>

    You can see the test code here, but only with one test post, and without linking, because i dont know how to do that:
    http://zetterstrand.com/media/

    You’re almost there!

    Remember… the sidebar links you want are like the permalink-titles of your posts. So you can use “almost the same code as in the content area”.

    <ul>
    <?php
    $mycategoryposts = get_posts('numberposts=-1&category=15');
    foreach($mycategoryposts as $mypostlink) {
    ?>
    <li><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php
    }
    ?>
    </ul>

    Use numberposts=-1 to list all posts in that category!

    inserted that code, thanks (changed $mypostlink to $post, didnt work otherwise?)

    Now I get a list, with permalinks.
    But the permalinks open in another window (the index template – how to stop that?)

    Create a template with the snippets you’ve got, then assign the template to the page you are trying to keep. The links should then pop up there.

    You’ll need a plugin though… something about “templates for posts”. Let me dig a bit!

    Thank you very much for your help

    Always welcome! 😉

    NOTE: showposts will become deprecated in time, and anything provided to that parameter is moved into posts_per_page field anyway, if you try to get into the habit of using posts_per_page in the same manner you do showposts then it’ll save having to remember in the days to come.

    Appreciate the codex examples may not all necessarily reflect that, but some of those pages are old and require a few updates.

    Simply a FYI… 🙂

    Good tip, I appreciate it.
    Cheers.

    I should of been paying attention when i wrote that, i’m not sure posts per page applies to get posts, but the information is relevant for any query_posts or WP_Query call.

    My fault for being so eager to respond…

    Leason learned… 🙂 At least until the next time.. 🙂

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘[Resolved] Is this design feasible?’ is closed to new replies.