I didn’t plan on doing this tutorial since part 9 of this series, but I wanted to add a few features. I go into detail on those features after the video.
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
4 Responses to “WordPress Featured Content 10”
Derek, this absolutely amazing stuff!! i can’t claim i understand everything that’s going on in real time, but it’s great material for me to study and your explanations are super.
One thing that I had been hoping be clear to me after watching this ‘featured content’ series, is how I would fetch: image, title and content data, from a post inside ‘the loop’, when the post-title is clicked. basically I’m looking to do is to avoid loading the single.php page and instead display all the post data in divs or a modal box…
i might be completely dim, and have totally missed the point here, but is there a simpler way of a achieving this than to do use arrays and the featured-category which you’re showing us here, to be able to get to that info?
sorry if i’m confusing this altogether.. I might temporarily be suffering from input overload..
thanks as usual for all your work!
Your email address will not be published.
This content was originally published here.