You could try with javascript, the following logic:
- On page load check if a hash exist in the url with something like:
var hash = decodeURIComponent(location.hash.substr(1));
- Then you would have two tables (one for team and one for advisors) with names matching the urls of your modals (e.g.: https://greentec-capital.com/team/peter-grouev/) like:
var teamHashes = ['peter-grouev', 'erick-yong'];
- After that you will check if the
hash
is inside of one of your tables*:
if teamHashes.indexOf(hash) !== -1 { //show modal logic }
*if hash
not in teamHashes
table, then check the advisorsHashes
table.
Now inside the above if
, to show the modal, we need to declare the $modal
like in your code and construct the url and make the ajax call to it, like:
if teamHashes.indexOf(hash) !== -1 {
var $teamModal = new tingle.modal({
footer: true,
stickyFooter: false,
closeMethods: ['overlay', 'escape'],
closeLabel: "Close",
cssClass: ['team-modal'],
onOpen: function() {
console.log('modal open');
},
onClose: function() {
console.log('modal closed');
$modal.setContent("");
},
var teamUrl = "https://greentec-capital.com/team/"+hash+"https://wordpress.stackexchange.com/";
$.ajax({
type: "POST",
url: teamUrl,
data: {},
success: function(result){
$modal.setContent(result);
$modal.open();
}
});
});
That should do it.