WordPress.org

Ready to get started?Download WordPress

Forums

Display posts from a single category on a page! (9 posts)

  1. romtim
    Member
    Posted 1 year ago #

    Hello.
    I am currently trying to display (not list) posts from a category on individual pages.

    I have a top menu which will have "Content" as an item in it. When you hover over "Content", it will bring up a child list "Reviews", "Guides", "Articles". These are all pages, of course.

    The thing is, I have created same categories too - Reviews, Guides, Articles. And each of my posts will be categorised as one of these 3. I want my Guides page to display only posts from the Guides category.

    All the guides I have seen help LIST the posts, I have succesfuly done it, but I need to DISPLAY them, as they are displayed in the News page. Neat, tidy, with title, date, author, comments, introduction text and thumbnail. I need it to look exactly as my news page.

    http://mmofollowers.com/news/

    Can anyone provide any help? I am not particularly strong in Php.
    Codes like

    <?php get_header(); ?>
    <?php $posts = get_posts('category=1&orderby=rand&numberposts=5'); foreach($posts as $post) { ?>
    <a href="<?php the_permalink() ?>" target="_parent"><?php the_title(); ?></a>
    <?php } ?>
    <?php get_footer(); ?>

    just give a list, and i need a complete display

  2. ricoh
    Member
    Posted 1 year ago #

    $posts = get_posts('category=1&orderby=rand&numberposts=5');
    	foreach($posts as $post) {
    		setup_postdata( $post );
    ?>
    <a href="<?php the_permalink() ?>" target="_parent"><?php the_title(); ?></a>
    <?php
    		the_author();
    		the_excerpt();
    		the_date();
    		if ( has_post_thumbnail( the_ID() ) ) {
    			the_post_thumbnail();
    		}
            }
    wp_reset_postdata();
    ?>

    Using the setup_postdata() function allows you to use the template functions to generate the information that you want to output, I added some of the functions for the info you were looking for (the codex can guide you to some others), be sure to add your html/css markup.

  3. romtim
    Member
    Posted 1 year ago #

    hello, thanks for your time
    what is the codex u talk about?

    i have got, unfortunately, no idea hwat html/css markup means. as i said
    I am not particularly strong in Php and stuff.

    [please allow more time to get a reply]

  4. ricoh
    Member
    Posted 1 year ago #

    http://codex.wordpress.org/, the online manual for WordPress, I would recommend bookmarking it as it will greatly help you in your journey through WordPress.

    The page markup is just how things are displayed in the browser, for instance the WordPress function the_author() outputs the author name but you would normally wrap that in an html element and possibly style it via css, for instance.

    <a href="<?php the_permalink() ?>" target="_parent"><?php the_title(); ?></a>
    <p><?php the_excerpt(); ?></p>
    <p class="style_author">Author: <?php the_author(); ?></p>
  5. romtim
    Member
    Posted 1 year ago #

    ok thanks, but is it possible to inherit the post css styles of my usual postings?
    Is that possible in some way?
    Instead of creating new css styles php files and so on - to apply existing settings and codes to the specific categories selecteD?

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    Neat, tidy, with title, date, author, comments, introduction text and thumbnail. I need it to look exactly as my news page.

    locate the template which is used for the 'news page', and possibly copy the html structure from there.

    or consider to post in the Artisteer forums.

  7. romtim
    Member
    Posted 1 year ago #

    So, you guys have no idea where the news page html structure is?

  8. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Not in an Artisteer theme.

  9. romtim
    Member
    Posted 1 year ago #

    By the way, is there any other good design-creating software that you could recommend? I can not create it on my own, it would take too much time and will likely not work for the first months of frustration.
    I have selected artisteer, since I didn't find anything better.

    [Bump deleted per the forum guidelines]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.