WordPress.org

Ready to get started?Download WordPress

Forums

W4 Post List
[resolved] Group by Post Category (8 posts)

  1. ChWebPro
    Member
    Posted 2 months ago #

    Great plugin! Is it possible to group by post category? (My list is alphabetical. It would be great to group by each letter. It would be even better to have each group collapsed showing just the letter, and you click to expand to see all the posts that start with that letter.)

    https://wordpress.org/plugins/w4-post-list/

  2. Shazzad Hossain Khan
    Member
    Plugin Author

    Posted 2 months ago #

    Hi,
    It should be fairly easy to create a Category + Post list , where category are sorted alphabetically. To do this -

    1. Go to List creation page.
    2. Select "List Type" = Category + Post
    3. Click on "Terms" Tab
    4. Set "Taxonomy" to "Category", "Orderby" to "Name", Order to "ASC", "Items per page" to -1
    5. Click on "Posts" Tab
    6. Set "Post Type" to "Post", "Post Status" to "Publish", "Orderby" to "Title", "Order" to "ASC".
    7. Click on "Template" Tab. Use this there -

    <ul>
    [terms]
      <li><a href="[term_link]" class="my_cat_link" data-toggle="#cpl_[term_id]">[term_name]</a>
      <ol class="my_post_list" id="cpl_[term_id]">
      [posts]
        <li><a href="[post_permalink]">[post_title]</a></li>
      [/posts]
      </ol>
      </li>
    [/terms]
    </ul>

    8. Click on "Style" Tab. Use this there -

    (function($){
      $(document).ready(function(){
        $('.my_post_list').hide();
        $('a.my_cat_link').click(function(e){
          e.preventDefault();
          $( $(this).data('toggle') ).toggle();
          return false;
        });
      });
    })(jQuery);

    9. Save the list. Copy the Shortcode and use it on Page, Post or Widget Area.

    Thanks for using the plugin.

  3. ChWebPro
    Member
    Posted 2 months ago #

    Thanks for your fast and helpful support!
    Can this be done also for grouping by post name?

  4. Shazzad Hossain Khan
    Member
    Plugin Author

    Posted 2 months ago #

    Please post a review here :)

    And there's no option for Group By Post name, and logically how could that be, is there multiple post with same name ?

  5. ChWebPro
    Member
    Posted 2 months ago #

    So, the idea would be...

    A
    Ace
    Apple
    Anna

    B
    Banana
    Bend

    Where Ace, Apple, etc are the post titles. They would be grouped by the first letter in the post title, so the long list is visually easy to navigate.

  6. Shazzad Hossain Khan
    Member
    Plugin Author

    Posted 2 months ago #

    Well, this is can be achieved.

    1. Install this plugin - Custom Post Type UI
    2. Register a Custom Taxonomy for Post (name it "Alphabet")
    3. Insert Some Terms (A,B,C,D) for that taxonomy.
    4. Then Chose appropriate taxonomy for each of the post. There's a bulk edit function which could be useful.
    5. Then create a new Post List - Category + Post
    6. On "Terms" tab - Select the newly created taxonomy (whatever you named it, maybe "Alphabet")
    7. Then follow the steps i posted earlier. (http://wordpress.org/support/topic/group-by-post-category?replies=5#post-5700427)
    8. On "Template" tab, remove the line -
    <a href="[term_link]" class="my_cat_link" data-toggle="#cpl_[term_id]">[term_name]</a> - (this is because you wont need to display the taxonomies)
    9. "Style" tab could be empty, as there's no show/hide mechanism.

    ** Taxonomy == Group (ex: Continent)
    ** Terms == Group Element (ex: Africa)

    Cheers :)

  7. ChWebPro
    Member
    Posted 2 months ago #

    Thanks! Where is step 3 completed? I can't find anything labeled "Terms" in the new plugin "Edit Custom Post Type or Taxonomy" section.

  8. Shazzad Hossain Khan
    Member
    Plugin Author

    Posted 2 months ago #

    I am not sure what they have named, Probably "Custom Taxonomies" or "CPT". And your won't find terms there. Lets assume you have created the CPT named "Alphabet". Then, you would see it under the Posts menu, below "Categories", "Tags".

    Hope it helps.

Reply

You must log in to post.

About this Plugin

About this Topic