Arras and the Featured-Content-Gallery plugin

For some time now, I have been using the Arras theme for WordPress on my website. The theme is pretty good compared to a lot of other themes and it [...]

For some time now, I have been using the Arras theme for WordPress on my website. The theme is pretty good compared to a lot of other themes and it has a very nice, professional, clean look and feel. It also sports a nice “Featured Post” slider on the front page, which makes the theme look even fancier.

However, I decided to use the Featured Content Gallery plugin for the generation of the “Featured Content” slider because it did offer a few more features and the slider did look a bit more professional.

Unfortunately, the Featured Content Gallery plugin (like many other such plugins) requires that all the posts that are to be “featured” be added to a specific category. Since, up to now, all my posts have been “featured” and there was no need for special category, I did not want to create one now just so I can include posts in the slider.

That’s when I got the idea to change the plugin so it will also accept a specific tag instead of a category. This way, I could add a tag to all the posts that I want to be “featured” and the slider will still work as designed.

Below, I will describe the changes that I made to enable using a tag for the slider.

  1. The first thing to do is to add support for selecting to use a tag versus any of the other, already available options. This means editing the options.php file in the plugin’s directory (wp-content/plugins/featured-content-gallery):
    1. After the line
      $gallerynewway = get_option('gallery-way') == 'new' ? "checked" : "";

      add the following line:

      $gallerytagway = get_option('gallery-way') == 'tag' ? "checked" : "";
    2. Change the width of the table from 690 pixels to 990 pixels:
      <table width="990" border="0" cellpadding="0" cellspacing="7">
    3. Add the new radio button to the selection – after the lines:
      <input type="radio" name="gallery-way" id="gallery-way" size="25" value="new" &nbsp;<?php print $gallerynewway; ?>>
          Select here to use individual post or page IDs&nbsp;

      add the following new HTML code:

      <td width="300">
      <input type="radio" name="gallery-way" id="gallery-way" size="25" value="tag" <?php print $gallerytagway; ?>>
       &nbsp; &nbsp;Sellect here to use tag selection </td>
    4. Add the new text entry where the tag name will be entered – after the lines:
      Post or Page IDs <span>(comma separated no spaces)</span>:<br />;
      &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input name="gallery-items-pages" id="gallery-items-pages" size="25" value="<?php echo get_option('gallery-items-pages'); >"></input>
      &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </td>

      add the lines

      Tag Name:<br />
                          <input name="gallery-tag" id="gallery-tag" size="25" value="<?php echo get_option('gallery-tag'); ?>"></input>
    5. Finally, add the new option that we’ve created (gallery-tag) to the list of plugin options – replace the line
      <input type="hidden" name="page_options" value="gallery-width,gallery-height,gallery-info,gallery-items,gallery-border-color,gallery-bg-color,gallery-text-color,gallery-use-featured-content,gallery-use-thumb-image,gallery-way,gallery-items-pages,gallery-category,gallery-fcg-button,gallery-fade-duration,gallery-delay,gallery-randomize-pages,gallery-rss-word-quantity,gallery-default-transaction" />

      with the line

      <input type="hidden" name="page_options" value="gallery-width,gallery-height,gallery-info,gallery-items,gallery-border-color,gallery-bg-color,gallery-text-color,gallery-use-featured-content,gallery-use-thumb-image,gallery-way,gallery-items-pages,gallery-category,gallery-tag,gallery-fcg-button,gallery-fade-duration,gallery-delay,gallery-randomize-pages,gallery-rss-word-quantity,gallery-default-transaction" />

      (Notice the the new “gallery-tag” appearing after the “gallery-category” string)

  2. Now, that we can select to use a tag and input which tag that would be, let’s change the code that generates the slider to use that tag. This change is in the gallery.php file:
    1. There is only one edit that new need to make here – allow for the use of the new tag selection mechanism. Fin the line:
      <?php query_posts('category_name=' . get_option('gallery-category') . '&showposts=' . get_option('gallery-items')); ?>

      and replace it with the following code:

       		if (get_option('gallery-way') == 'tag')
       			$cust_query = 'tag=' . get_option('gallery-tag');
       			$cust_query = 'category_name=' . get_option('gallery-category');
       		query_posts($cust_query . '&showposts=' . get_option('gallery-items')); ?>
  3. Finally, we’ll have to add the tag to all the posts that we’d like to appear on the slider. This is done in the Posts->Edit screen of the Admin panel. You can select all the posts and add the tag at once so you won’t have to do it for every post, individually.

An unfortunate side effect of this is that if you are using a Tag Cloud plugin on your WordPress site, the tag that you’ve selected to use for the slider will most likely end up being the most used tag and will appear boldest.

An easy fix for this is to edit the plugin/widget’s call to wp_tag_cloud and exclude that tag using the ‘exclude=’ argument.

VN:F [1.9.13_1145]
Rating: 3.8/5 (9 votes cast)
VN:F [1.9.13_1145]
Rating: +3 (from 5 votes)
Arras and the Featured-Content-Gallery plugin, 3.8 out of 5 based on 9 ratings