Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- first the java...*this could be done far easier with Jquery*... just couldnt get the library when i was working on this..*
- you'll need to put a copy of filters.svg on your site somewhere...
- open a text file ...paste this...
- `<svg xmlns="http://www.w3.org/2000/svg">
- <filter id="grayscale">
- <feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"/>
- </filter>
- </svg>`
- save as filters.svg...FTP file to your site...remember the complete url.
- 1st go to loop-slider.php
- look for `return DO_NOTHING; }}`... paste next bit immediately after.
- '<script type="text/javascript">
- function changebg<?php the_ID(); ?>(){
- var x="<?php $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slider-thumb' ); ?>"
- document.getElementById('post-<?php the_ID(); ?>').style.cssText="background-image:url(<?php echo $thumbnail[0]; ?>); -webkit-filter: grayscale(1%); -moz-filter: grayscale(1%);";
- }
- function changebgback<?php the_ID(); ?>(){
- var x="<?php $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'slider-thumb' ); ?>"
- document.getElementById('post-<?php the_ID(); ?>').style.cssText="background-image:url(<?php echo $thumbnail[0]; ?>); filter: url(http://yellowrootllc.com/site2/filters.svg#grayscale); filter: gray;-webkit-filter:grayscale(100%);-moz-filter: grayscale(100%);";
- }
- </script>`
- look for `<div id="post-<?php the_ID(); ?>`
- replace entire paragraph with
- `<div id="post-<?php the_ID(); ?>" <?php post_class(); ?><?php if( isset( $thumbnail ) ) : ?> onmouseover="changebg<?php the_ID(); ?>();" onmouseout="changebgback<?php the_ID(); ?>()" style="background-image:url(<?php echo $thumbnail[0];?>); filter: url(http://yellowrootllc.com/site2/filters.svg#grayscale);-webkit-filter:grayscale(100%); filter: gray;-moz-filter: grayscale(100%);"<?php endif; ?>>`
- change url to your svg file url, make sure to keep the "#grayscael" at the end of the url ...
- im pretty sure thats it... i have about 7 changes still in there that i have commented out, but left in... so just make sure to save your loop-slider.php file first...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement