Hi,
I’m trying to filter my url. I already filter my $journal items by looking if it’s a vimeo or youtube video.
But now I also want to filter the url, to get only the vimeo and youtube video ID. I want to put it in the data-youtube and data-vimeo attribute I created in the link.
https:// youtube . com /watch?v=uf2-5uDEkS8
https:// vimeo .com /176537673
This is my current code:
<?php if(!$journal->filterBy('videoUrl', 'vimeo')): ?>
<li class="item">
<img src="<?php echo $journal->overviewImage()->toFile()->focusCrop(371)->url() ?>" alt="<?php echo $journal->title()->html() ?>" />
<a href="<?php echo $journal->videoUrl() ?>" data-vimeo="<?php echo $journal->videoUrl() ?>" >
<span class="caption">
<h2 class="title">
<?php echo $journal->title()->html() ?>
</h2>
<span class="details">
<?php echo $journal->date('F j, Y') ?>
</span>
</span>
</a>
</li>
<?php else: ?>
<li class="item">
<img src="<?php echo $journal->overviewImage()->toFile()->focusCrop(371)->url() ?>" alt="<?php echo $journal->title()->html() ?>" />
<a href="<?php echo $journal->videoUrl() ?>" data-youtube="<?php echo $journal->videoUrl() ?>" >
<span class="caption">
<h2 class="title">
<?php echo $journal->title()->html() ?>
</h2>
<span class="details">
<?php echo $journal->date('F j, Y') ?>
</span>
</span>
</a>
</li>
<?php endif ?>
I hope someone can help me out!
Cheers!