WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display category & subcategories Post in 3 columns w/ thumbnail and post title (12 posts)

  1. yuenwah
    Member
    Posted 1 year ago #

    Hello,

    I want to make a page displaying certain category with the subcategories in grid post form in 3 column.

    The layout as below:

    A Category Name
    A category description

    Sub-category 1 for category A

    Post 1 Post 2 Post 3
    Post 4 Post 5 Post 6

    Sub-category 2 for category A

    Post 1 Post 2 Post 3
    Post 4 Post 5 Post 6

    Which post display in thumbnail and post title below only.
    Do anyone know how to make the layout like this ?
    Thanks !

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Yeah, this is a CSS issue and not a WordPress issue. Are you familiar with CSS?

  3. yuenwah
    Member
    Posted 1 year ago #

    Thank you for message.

    CSS is okay for me!
    I am not good in PHP code.

    I manage to put the post in 3 column displaying horizontally.
    But can't not display one sub-category after one sub-category with Sub-category title.

    Thanks !

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

    what theme are you using?

    can you post a link to what you have so far?

    what part is the problem:
    - category templates?
    http://codex.wordpress.org/Category_Templates

    - the query, loop, and php for thumbnail etc?
    http://codex.wordpress.org/Class_Reference/WP_Query
    http://codex.wordpress.org/The_Loop
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail
    http://codex.wordpress.org/Function_Reference/get_category

    - the layout?

  5. yuenwah
    Member
    Posted 1 year ago #

  6. yuenwah
    Member
    Posted 1 year ago #

    Thanks alchymyth
    Thanks for your information.
    Very helpful !

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

    for the category 'catalog' only, possibly create a page template file;

    some idea for the code:
    http://pastebin.com/4USFCKGA

  8. yuenwah
    Member
    Posted 1 year ago #

    alchymyth,
    Thanks a million.
    I will try it !

  9. yuenwah
    Member
    Posted 1 year ago #

    alchymyth,

    It work prefect.
    You are the expert for wordpress.

    Do you think I should make a category template for displaying the certain category instead of a page template ?

    Thanks !

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

    Do you think I should make a category template for displaying the certain category instead of a page template ?

    ths would be a question of preference how you want to call the 'catalog' from your menus; if you want to treat 'catalog' like a 'normal' category, you could use a category template.

    be aware, that turning the suggested code into a category template might need some changes:

    - save the file as category-catalog.php
    - remove the page template name section
    - optional: change this line: <?php $category = get_term_by('slug', 'catalog', 'category');
    to: <?php $category = get_category( get_query_var('cat') );

    (untested)

  11. yuenwah
    Member
    Posted 1 year ago #

    alchymyth,

    Thanks again and again.
    You help me a lot.

    I want the catalog as normal category.
    I will try to revise.
    I believe you code is 100% work.
    Thanks !

  12. yuenwah
    Member
    Posted 1 year ago #

    Hi alchymyth,

    I tested, the code work prefect.
    Thank you very much !
    I will follow your website to learn more about wordpress.
    And of course will make some donate.

    Thanks again !

Topic Closed

This topic has been closed to new replies.

About this Topic