Relate 2 post types with similar taxonomy and highlight similar terms
I am trying to compare terms of a taxonomy shared by two different custom post types. I would like to output both sets of terms, and if there are any similar terms, add a class to highlight these like terms (make red).
My examples revolve around a musical concert. I have post types of "Show" and "Picks" which both have the taxonomy of "songs_played". I already created a loop within each "Show" that calls all related "Picks" posts, by date. These show at the bottom of each Show landing page.
Right now I have setup so that a user can submit, through a form, their selections for what songs they think will be played ate the show, thus creating their own "Picks" post type. Their submission creates the post and adds appropriate "songs_played" taxonomy terms selections to that post.
So, when called at the bottom of each show page, I want to then compare that output list of terms, to those that may be similar within the "Show".
Sorry if confusing....here is SUPER LAYMAN's terms:
Landing page is: Bruce Springsteen 10/31/78
This page ("Show" post type) shows the setlist, all songs that Bruce actually did play.
Below on the page, by way of a loop, I display all fan's "Picks" on what they think will be played.
If a song is played, it gets added to the "Shows" taxonomy of "songs_played" and if is similar, in someone's "Picks" down below, this like term will be highlighted red.
Dream would be to add points to that system.
Thoughts? Advice?
php loops custom-post-type
add a comment |
I am trying to compare terms of a taxonomy shared by two different custom post types. I would like to output both sets of terms, and if there are any similar terms, add a class to highlight these like terms (make red).
My examples revolve around a musical concert. I have post types of "Show" and "Picks" which both have the taxonomy of "songs_played". I already created a loop within each "Show" that calls all related "Picks" posts, by date. These show at the bottom of each Show landing page.
Right now I have setup so that a user can submit, through a form, their selections for what songs they think will be played ate the show, thus creating their own "Picks" post type. Their submission creates the post and adds appropriate "songs_played" taxonomy terms selections to that post.
So, when called at the bottom of each show page, I want to then compare that output list of terms, to those that may be similar within the "Show".
Sorry if confusing....here is SUPER LAYMAN's terms:
Landing page is: Bruce Springsteen 10/31/78
This page ("Show" post type) shows the setlist, all songs that Bruce actually did play.
Below on the page, by way of a loop, I display all fan's "Picks" on what they think will be played.
If a song is played, it gets added to the "Shows" taxonomy of "songs_played" and if is similar, in someone's "Picks" down below, this like term will be highlighted red.
Dream would be to add points to that system.
Thoughts? Advice?
php loops custom-post-type
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14
add a comment |
I am trying to compare terms of a taxonomy shared by two different custom post types. I would like to output both sets of terms, and if there are any similar terms, add a class to highlight these like terms (make red).
My examples revolve around a musical concert. I have post types of "Show" and "Picks" which both have the taxonomy of "songs_played". I already created a loop within each "Show" that calls all related "Picks" posts, by date. These show at the bottom of each Show landing page.
Right now I have setup so that a user can submit, through a form, their selections for what songs they think will be played ate the show, thus creating their own "Picks" post type. Their submission creates the post and adds appropriate "songs_played" taxonomy terms selections to that post.
So, when called at the bottom of each show page, I want to then compare that output list of terms, to those that may be similar within the "Show".
Sorry if confusing....here is SUPER LAYMAN's terms:
Landing page is: Bruce Springsteen 10/31/78
This page ("Show" post type) shows the setlist, all songs that Bruce actually did play.
Below on the page, by way of a loop, I display all fan's "Picks" on what they think will be played.
If a song is played, it gets added to the "Shows" taxonomy of "songs_played" and if is similar, in someone's "Picks" down below, this like term will be highlighted red.
Dream would be to add points to that system.
Thoughts? Advice?
php loops custom-post-type
I am trying to compare terms of a taxonomy shared by two different custom post types. I would like to output both sets of terms, and if there are any similar terms, add a class to highlight these like terms (make red).
My examples revolve around a musical concert. I have post types of "Show" and "Picks" which both have the taxonomy of "songs_played". I already created a loop within each "Show" that calls all related "Picks" posts, by date. These show at the bottom of each Show landing page.
Right now I have setup so that a user can submit, through a form, their selections for what songs they think will be played ate the show, thus creating their own "Picks" post type. Their submission creates the post and adds appropriate "songs_played" taxonomy terms selections to that post.
So, when called at the bottom of each show page, I want to then compare that output list of terms, to those that may be similar within the "Show".
Sorry if confusing....here is SUPER LAYMAN's terms:
Landing page is: Bruce Springsteen 10/31/78
This page ("Show" post type) shows the setlist, all songs that Bruce actually did play.
Below on the page, by way of a loop, I display all fan's "Picks" on what they think will be played.
If a song is played, it gets added to the "Shows" taxonomy of "songs_played" and if is similar, in someone's "Picks" down below, this like term will be highlighted red.
Dream would be to add points to that system.
Thoughts? Advice?
php loops custom-post-type
php loops custom-post-type
edited Nov 26 '18 at 7:38
K.Dᴀᴠɪs
7,330112440
7,330112440
asked Nov 26 '18 at 2:19
Roger YoungRoger Young
11
11
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14
add a comment |
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473991%2frelate-2-post-types-with-similar-taxonomy-and-highlight-similar-terms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473991%2frelate-2-post-types-with-similar-taxonomy-and-highlight-similar-terms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The question doesn't appear to include any attempt at all to solve the problem. StackOverflow expects you to try to solve your own problem first, as your attempts help us to better understand what you want. Please edit the question to show what you've tried, and show a specific roadblock you're running into with Minimal, Complete, and Verifiable example. For more information, please see How to Ask.
– Andreas
Nov 26 '18 at 4:14