In PODS template, How to compare Fields
-
Hi,
I have a pods template to generate a select list of players for my current team. This template is being used on a player page. It shows a dropdown select of all of the team’s players. I have it working but I’d like to have it select the current player being viewed. So I think I need to compare the current page permalink to the looped players permalink and set selected for the one that matches. I don’t know the syntax to get the current page permalink and do the comparison within the [each] loop. Is this possible? Is php available in the pods template? Below is my code:<a href="{@current_team.permalink}">{@current_team} {@current_team.age_bracket}</a> <select id="player_sel_id" name="player" class="players-list"> [each current_team] [each players] <option name="{@post_slug}" value="{@permalink,esc_url}" />{@post_title}</option> [/each] [/each] </select> <script> document.getElementById("player_sel_id").addEventListener("change", function (event) { location.href = event.target.value; }); </script>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘In PODS template, How to compare Fields’ is closed to new replies.