WordPress.org

Ready to get started?Download WordPress

Forums

Which widget plugin or what php? (4 posts)

  1. saganaki
    Member
    Posted 6 years ago #

    Anyone ever seen a widget or know the php to do the following?

    It's about taking a set of posts from one category and breaking them down by another

    On my blog I have a set of categories relating to location and another by industry. I have a different pages dedicated to each industry (I only look at 4) and on these pages only posts tagged with that particular industry are displayed using postlist.

    In the sidebar I would like to be able to break down an industry by location. For example the page might show posts in category software, then in the tool bar in the right you could select to show posts about software only by a particular country category. The sidebar would be a menu showing only the country categories that had been used in different software posts.

    Is there a widget to do this already? Otherwise, I don't think the php to do this is too tricky and you could even put into the widgets that allow you to enter inline php.

    Any ideas?

  2. Roger Theriault
    Member
    Posted 6 years ago #

    Try recent-posts-plugin, it seems to have a million options.

    You didn't provide a blog link, so it's kind of hard to get more precise.

  3. saganaki
    Member
    Posted 6 years ago #

    @Roger

    Great coincidence - trying to do a real estate blog too!

    Here's the blog.

    This page will eventually contain a big list of real estate agents. All these agents are individual posts tagged with the category real estate agents (To display the single category of posts in combination with static text at the top I've used postlists

    These agents are located in different regions and I have categories for these regions. I'd like to have a siderbar widget that lists the different regions the agents are listed in, and when clicked, only displays the agents in that region. Be great if I could display it as a list of categories and subcategories, show post counts beside the categories and hide empty parent categories...

    Haven't yet found a widget/plugin combo that does this. I'm not sure if there is a built in WP php function that allows you to do an and function on two categories. I'm pretty sure there's a function that navigates through categories trees. The code could combine the two with results in an array and display the array results as the list of regions.

  4. saganaki
    Member
    Posted 6 years ago #

    Discovered a code plugin that does half the job:

    category magic

    puts up links to posts that belong to two categories.... this function call: glmdobcat('x','y','z')...This call returns the last z numbers of posts that belong to BOTH, x and y, categories.

    Next step needed is a function to figure out the number of posts in each category so only locations in that have real estate agents are shown. (eg real estate agents in Tokyo 4, real estate agents in nagasaki 12).Even better would be able to have the category hierarchy displayed, but I guess that complicates things even more...

    I am aiming to put together code that takes a category hierarchy, then:
    * checks the number of posts at each level that would be displayed by glmdobcat('x','y','99999')
    * if not zero, display the category name, number of posts and builds url to that will trigger glmdobcat('x','y','9999')
    *keep going till at bottom of hierarchy.

Topic Closed

This topic has been closed to new replies.

About this Topic