Forums

[resolved] How to make specific list from total categories? (14 posts)

  1. stoicshohag
    Member
    Posted 1 year ago #

    I'm running a lawyer Law firm information website. I faced a problem when i want to publish Lawyer/law firm list in a page from whole categories.

    http://www.worldlawyerinfo.com/areas-of-practice

    Now, from this page, i want "By Country and City" to publish in another page.

    i used this code here: `<b>
    <?php wp_list_categories() ?>
    </b>`

    What do i do?

    Any kind of help will be appreciated.

    Thanks

  2. vtxyzzy
    Member
    Posted 1 year ago #

    To exclude the category, use the exclude_tree argument:

    $args = array(
       'exclude_tree' => '62',  // The category id of the parent
    );
    wp_list_categories($args);

    To list only the children of the category, use this:

    $args = array(
       'child_of' => '62',
    );
    wp_list_categories($args);
  3. stoicshohag
    Member
    Posted 1 year ago #

    vtxyzzy @ Thanks a lot!

    see it: http://www.worldlawyerinfo.com/by-country-city

    how to remove "catagorie" text ?

  4. vtxyzzy
    Member
    Posted 1 year ago #

    See all wp_list_categories parameters.

    You suppress the outer list item by using the 'title_li' parameter:

    $args = array(
       'child_of' => '62',
       'title_li' => '',
    );
  5. stoicshohag
    Member
    Posted 1 year ago #

    great man, thanks again !

  6. vtxyzzy
    Member
    Posted 1 year ago #

    If your problem has been solved, please use the dropdown on the right to mark this topic 'Resolved' so that anyone else with this question can see that there is a solution.

  7. stoicshohag
    Member
    Posted 1 year ago #

    another ques: if i don't want a category to be published in page. then what ?

    ok. i'll change it to resolved.

  8. vtxyzzy
    Member
    Posted 1 year ago #

    Sorry, I don't understand your question. Please explain with an example.

  9. stoicshohag
    Member
    Posted 1 year ago #

    suppose, go to http://www.worldlawyerinfo.com/areas-of-practice here. then i want to remove "By Country and City" category from this page . how to ?

  10. vtxyzzy
    Member
    Posted 1 year ago #

    See my post above under this:

    To exclude the category, use the exclude_tree argument:

  11. stoicshohag
    Member
    Posted 1 year ago #

    not working

  12. vtxyzzy
    Member
    Posted 1 year ago #

    Did you change '62' to the id of your parent category?

    Please post the code for your $args array.

  13. stoicshohag
    Member
    Posted 1 year ago #

    ya i changed.

    i put there

    <?php
    $args = array(
    'exclude_tree' => '932', 'title_li' => 'Areas of practice'
    );
    wp_list_categories($args);
    ?>

    but same results

  14. vtxyzzy
    Member
    Posted 1 year ago #

    If 932 is the same id you used to show only that category on the "By Country and City" page, I cannot explain it.

Topic Closed

This topic has been closed to new replies.

About this Topic