I also wanted to show you how to use the Featured Content Slider I made for WordPress. All of the code is available in a zipped archive.
I’m not going to upload this to the WordPress plugin depository, so this is the only place to get it. Don’t worry it is still free to use however you’d like.
If you missed part 1 of this series, it is available here WordPress Featured Content Plugin.
The Changes I Made
There were only 2 changes made since last time, but they are important changes. The zipped archive above already contains these fixes!
Around line 274 I added the following
// Point toward the location of the featured data file
$ntt_print_test = ‘../wp-content/plugins/NTTFeaturedContent2/js/featured_data’ . $ntt_start_post . ‘.txt’;
// Realpath will work out the directory information automatically
// Realpath return the directory information that proceeds /wp-content
$ntt_print_to = realpath($ntt_print_test);
I think the comments are self explanatory. I made this change so that this plugin will automatically figure out what site it is being hosted on.
So, now you know how to use realpath to find the absolute path name for a website.
On line 272 of this file I added a regular expression, followed by the letter g like this /\/s\g. This allows me to replace all spaces with dashes. The previous code only replaced the first instance. Just a silly bug.
var pict_name_for_excerpt = pict_title.toLowerCase().replace(/\s/g, ‘-‘);
Thanks a Bunch
I really enjoyed doing this tutorial. It was fun to teach a more challenging topic. I’ll now continue with my tutorial on how to create a WordPress News Theme. Part 1 of that series is here if you want to be prepared.
Till Next Time