GithubHelp home page GithubHelp logo

harvardchanschool / multisite-taxonomies Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 4.0 396 KB

A WordPress plugin to register custom taxonomies accessible on your entire multisite network.

License: GNU General Public License v3.0

PHP 92.89% Shell 0.07% JavaScript 6.22% CSS 0.82%
wordpress wordpress-multisite wordpress-plugin wordpress-taxonomies

multisite-taxonomies's People

Contributors

dpegasusm avatar guillaumemolter avatar lsutherl avatar neverything avatar nicholsonjf avatar schuhwerk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multisite-taxonomies's Issues

Multisite taxonomies/terms for users

Hello! Me again. Thanks for your work! ๐Ÿ‘‹

Tldr.: Are you interested integrating user- and blog-terms (assigning multisite-terms not only to posts, but to sites and users)? You can find the implementation for users here.

And the longer version:
I was working on adding multisite-taxonomies to network-users for the last few days:

$taxonomy_slug = 'job';
$object_type   = 'user';
register_multisite_taxonomy( $taxonomy_slug, $object_type, $args );

The taxonomy-selectbox appears on the profile-page of a user.
Everything works the same as before for other taxonomies.

But why?

We are a big university (with ~20k people) which is grouped into many faculties, wich are subgrouped into organisations, and sub-communities (of students and teachers).
Imagine a big category-tree-structure (with ~300 entries), let's call them affiliations.
We want to assign those terms to users, blogs and also posts and make the right blogs/posts visible/filterable for the right group of people.

Why not use regular WordPress taxonomies?

We use the same tree of taxonomies three times: for users, blogs, and posts.
I wrote a library to sync terms between taxonomies (and everything is working fine), but it is not a pleasure to work with:

  • "Show all blogs, which are assigned to the current user's faculty". This requires you to:
    • switch to the blog, where your affiliations live.
    • get_the_user's affiliations. Map them to the blog-affiliation's term id
    • Query the other taxonomy for the blog_ids
    • switch back
  • Managing terms/taxonomies, which affect the whole network should not live in a blog (but in the network-admin).
  • The WordPress structure for taxonomies is quite smart and flexible, but it can not be used to share terms between different object-types (unless you are willing to support your own WordPress fork). Multisite-taxonomies looks like a perfect place to start.

Issues

  • When I assign a term to a user, the blog_id is also assigned, which does not make sense in my use-case. This could lead to confusion (or be nice in other use-cases).
  • Same for blogs.
  • There is currently no page when clicking on the number below "Count" in the network-taxonomy-admin interface ![[Pasted image 20230202142810.png]]
  • ID-collisions:
    $object_types = array( 'user', 'post' );
    register_multisite_taxonomy( $taxonomy_slug, $object_types, $args );
    If you assign multiple object_types (that do not have unique ids) to a taxonomy you will not be able to distinguish, if a term has been assigned to the user with the id "1" or the post with the id "1". So I disabled it (for now). Looking ahead (not part of this issue/question): wp_multisite_term_multisite_taxonomy could be used to create unique multisite_term_multisite_taxonomy_id s for (non-post) object_types.

Chances

  • Central role/capability management (just add a multisite_term_meta with capabilities to a user_multisite_term)
  • Multisite-categories for blogs.
  • Longer-term (also looking ahead): Assign (multiple) terms to terms ๐Ÿคฏ

What do you think? - Should I create a PR? - Or should it just live in our fork?
Thanks for your time!

Question: How to use this plugin for multisite taxonomy archive pages

First of all thanks a lot for this plugin, it takes the project I'm working on for a university a long way already.

Rewrite rules are working, how to build a proper posts query?

Internally we are using two multisite taxonomies, one for posts (global_post_tag) and one for comments (global_comment_tag, assigned to the post).

The rewrite rules for the pseudo archive pages are registered and working, see screenshot from Query Monitor:

multisite-taxonomies-archive-qm

Could you give me a hint on how to implement an archive page that includes all posts in the multisite tagged with wordpress in one of the before mentioned taxonomies?

My current approach is to use the Multisite_Taxonomy_Query class alongside the pre_get_posts filter to set up the query. I saw that you are working on an example plugin https://github.com/HarvardChanSchool/multisite-taxonomies-frontend, but it's not working outside your context yet (missing functions like is_multitaxo()).

Thanks a lot for a quick feedback on this.

how to use this plugin?

How to install and use this plugin? There is no documentation or readme file. i just installed and trying. But only one menu is available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.