Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS WordPress: Posts from Categories on a Page

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35579
    dfazman
    Member

    I am using WordPress and a purchased theme (Thesis). I have groups of products, each an individual post, and sorted into various categories. I have figured out a few ways to display the posts from a single category on a page, but I am having trouble making everything look the way I want. Specs are:

    – I want all posts from a category on a page
    – Need the Category description or (even better) some static page content before the posts display
    – Posts should list in Alphabetical order
    – Posts should look exactly like they do in The Loop – nothing fancy.

    I’ve tried a plugin, (List Category Posts) which does everything I want but the post names are in an unordered list that show the title as a link, and not like a normal post. If I could style the post name, it would be fine.

    I have also tried using the built-in “category page” option (www.yoursite.com/category/yourcategory). This option is also almost perfect, but I have not figured out how to make the Category Description display below the Category Title but before the posts (I need some descriptive text about the category on the page before the products list).

    Any help you can offer would be awesome. I don’t know CSS or PHP, but I have had some limited success as I hack away at it.

    Thanks,
    Brian

    #92425
    TheDoc
    Member

    Hey Brian,

    Unfortunately the solution I would give you definitely would require some technical knowledge, at the minimum a strong knowledge of WordPress. Here’s what I would do:

    • Create a new template in your theme
    • Make the loop on that page go through a specific category
    • Create a new page in WordPress and select your new template as that page’s template
    #92738
    dfazman
    Member

    Thanks, Doc. I’ve already resigned myself to that approach, but I’m really struggling with it. I’m not a complete idiot fortunately, I just have never been taught to code. It all looks like a logic statement to me, I just don’t know what “things I can say” to make the code work.

    I found this code that I’m putting in my custom functions:

    function my_page_of_posts() {
    if (is_page('833')) {
    $custom_loop = new WP_Query('posts_per_page=5&cat=9');
    echo '
      ';
      if ( $custom_loop->have_posts() ) : while ( $custom_loop->have_posts() ) : $custom_loop->the_post();
      echo '
    • ' . get_the_title() . ' ( ';
      comments_number('0', '1', '%');
      echo ' )
    • ';
      endwhile;
      wp_reset_query();
      endif;
      echo '
    ';
    }
    }
    add_action('thesis_hook_after_content','my_page_of_posts');

    It works like a charm, and I even figured out how to get my page number and category number plugged in. The problem is the output. I don’t know what “echo” means, can’t figure out what to put there (or remove) to get the output I want. It’s funny – I just want every post in a category, complete, just like the normal loop. Not links to posts or an ordered list. Just toss everything in there! Basic, right? Can you assist?

    – B

    #92740
    dfazman
    Member

    P.S. The theme I’m using allows for this code in the custom functions to do exactly what I’m trying to do, so if I can just figure out proper parameters I should be all set!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.