Bootstrap 5 Walker for Sage 10
A WordPress NavWalker intended to be used with the Soil plugin in a Sage 10 project. Extends the nice Soil walker and adds Bootstrap 5 classes.
Read PostA WordPress NavWalker intended to be used with the Soil plugin in a Sage 10 project. Extends the nice Soil walker and adds Bootstrap 5 classes.
Read PostI was honored to speak at WordCamp Baltimore today. Here’s a link to my slides and notes from my presentation.
Read PostWordPress 4.5 added the custom logo feature. It’s pretty nice, and where possible I try to use native WordPress functionality, but the default markup returned by get_custom_logo() isn’t always what I’m looking for. Fortunately there’s a filter included just for this.
Read PostLast night while browsing the Roots Discourse I came across a cool share by a user who has written a little utility to handle a request he often gets from designers and content creators. User MWDelaney writes – I can’t count the number of times my designers have asked to make a single word in…
Read PostWe’ve been doing a lot of videos on our sites lately. Well, we’ve always done a lot of videos on our sites. The model is usually an on-page embed, either directly in page or via a modal, and we set the back-end up to use the oEmbed field in Advanced Custom Fields Pro. It gives a great back-end experience – and why use WordPress if it’s not going to be user configurable, right?
Anyway, in almost every case we need to disable the display of related videos. The problem has already been solved, but I’m doing this often enough that I wrote this simple, but handy little function to take care of it. Configure the parameters in the function itself, and just pass it your field name. Outputs the URL and everything in the $params array gets passed in on the tail end as a query string.
/**
* oEmbed Attributes
*
* Add parameters to oEmbed query string. Useful for
* turning off related videos and such.
*
* Basic field use: $video = videoLink('your_field_name');
* Add second param if in a repeater: $video - videoLink('your_subfield_name', true);
*
* @see https://www.advancedcustomfields.com/resources/oembed/
*
* @param $field
* @param bool $repeater defaults to false / true if repeater
* @return mixed embed HTML
*/
function videoLink($field, $repeater = false) {
global $post;
// get current post ID
$id = $post->ID;
if(!$repeater) {
// get the field
$videoFrame = get_field( $field, $id );
} else {
// if we are in a repeater
$videoFrame = get_sub_field( $field, $id );
}
// use preg_match to find iframe src
preg_match('/src="(.+?)"/', $videoFrame, $matches);
$src = $matches[1];
// add extra params to iframe src
$params = array(
'rel' => 0
);
$new_src = add_query_arg($params, $src);
$videoLink = str_replace($src, $new_src, $videoFrame);
return $videoLink;
}
To use it somewhere just pass it your field name. So, if your ACF field is my_video:
echo videoLink('my_video');
If you’re rolling with a repeater, just set the second parameter to true.
echo videoLink('my_video', true);
Read Post
Here’s a short screen cast showing how to maintain the Roots stack once it’s been deployed. In this screen cast I update WordPress core, Jetpack, and the WordPress SEO Framework plugin. The SEO plugin is a little quirky with updating, but aside from that you’ll see that everything goes smoothly and it’s a super easy…
Read PostThis is the third in a series of screencasts that will document the process of moving a WordPress website from a shared hosting provider to a Digital Ocean droplet with Trellis, Bedrock, and Sage, with an SSL from Let’s Encrypt. Correction: The video opens with: …this is part four of a three part series… Sorry,…
Read Post