Featured Content Gallery | WordPress Plugin | iePlexus

Solution to Remove Inline Style from FCG 3.2

New releases, ideas for the future, and known issues

Solution to Remove Inline Style from FCG 3.2

PostBy CharlesClarkson on Sat Aug 08, 2009 11:32 am

Hello, I was cleaning a page for a client and wanted to move the inline styles from the body to header where the validation program wouldn't complain about it. The solution was easier than I thought it might be. This solution does require updating the FCG files. So, the change will be wiped out on the next update of FCG.

Cut this section from the gallery.php file:
Code: Select all
<style type="text/css">

.jdGallery .slideInfoZone
{
   height: <?php echo get_option('gallery-info'); ?>px;
}
</style>


Then paste it into the gallery_styles() function in the content-gallery.php file:
Code: Select all
$galleryscript .= sprintf(
    "<style type=\"text/css\">\n.jdGallery .slideInfoZone {\n    height: %s;\n}\n</style>\n",
    get_option('gallery-info')
);
 


Actually, we could add a default height while we are at it. Without a default we get invalid CSS if the 'gallery-info' is not set.
Code: Select all
$height = get_option('gallery-info');
if ( ! $height ) {
    $height = 80;
}
$galleryscript .= sprintf( "<style type=\"text/css\">\n.jdGallery .slideInfoZone {\n    height: %spx;\n}\n</style>\n", $height ); 


So, the whole function looks like this:
Code: Select all
function gallery_styles() {
    /* The next lines figures out where the javascripts and images and CSS are installed,
    relative to your wordpress server's root: */
    $gallery_path =  get_bloginfo('wpurl')."/wp-content/plugins/featured-content-gallery/";

    /* The xhtml header code needed for gallery to work: */
    $galleryscript = "
    <!-- begin gallery scripts -->
    <link rel=\"stylesheet\" href=\""
.$gallery_path."css/jd.gallery.css.php\" type=\"text/css\" media=\"screen\" charset=\"utf-8\"/>
    <link rel=\"stylesheet\" href=\""
.$gallery_path."css/jd.gallery.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\"/>
    <script type=\"text/javascript\" src=\""
.$gallery_path."scripts/mootools.v1.11.js\"></script>
    <script type=\"text/javascript\" src=\""
.$gallery_path."scripts/jd.gallery.js.php\"></script>
    <script type=\"text/javascript\" src=\""
.$gallery_path."scripts/jd.gallery.transitions.js\"></script>
    <!-- end gallery scripts -->\n"
;

    $height = get_option('gallery-info');
    if ( !$height && 0 != $height ) {
        $height = 80;
    }
    $galleryscript .= sprintf( "<style type=\"text/css\">\n.jdGallery .slideInfoZone {\n    height: %spx;\n}\n</style>\n", $height );

    /* Output $galleryscript as text for our web pages: */
    echo($galleryscript);
}
 
Charles Clarkson
StudioPress | Senior Moderator.

Don't work with one arm tied. Use Firebug for Firefox
User avatar
CharlesClarkson
 
Posts: 6
Joined: Tue Jul 28, 2009 6:33 am

Re: Solution to Remove Inline Style from FCG 3.2

Thank you for using the Featured Content Gallery Forum
 

Return to Development, Improvement, and Conflicts

Who is online

Users browsing this forum: No registered users and 0 guests

cron