get the grid view by default – Sight 1.0.1 Wpshower Theme
I have seen the question of how to have the grid view by default on the beautiful Sight 1.0.1 Theme by Wpshower on the web a couple of times now. And I liked the grid view better than the list view as well. Unfortunately I couldn’t find an answer on the web…
So I figured it out myself. It took me a couple of hours and a lot of trial and error to get there.
I originally wrote the answer on stackoverflow:
You have to modify a line on each of the index.php
, loop.php
and archive.php
.
index.php Line 5:
<a href="javascript: void(0);" id="mode"<?php if ($_COOKIE['mode'] == 'list') echo ' class="flip"'; ?>></a>
loop.php line 3:
<div id="loop" class="<?php if ($_COOKIE['mode'] == 'list') echo 'list'; else echo 'grid'; ?> clear">
archive.php line 22:
<a href="javascript: void(0);" id="mode"<?php if ($_COOKIE['mode'] == 'list') echo ' class="flip"'; ?>></a>
Then you’ll also have to modify the js/script.js
.
script.js lines 45-63:
/*** View mode ***/
if ( $.cookie('mode') == 'grid' ) {
grid_update();
} else if ( $.cookie('mode') == 'list' ) {
list_update();
}
$('#mode').toggle(
function(){
if ( $.cookie('mode') == 'list' ) {
$.cookie('mode','grid');
grid();
} else {
$.cookie('mode','list');
list();
}
},
function(){
if ( $.cookie('mode') == 'grid') {
$.cookie('mode','list');
list();
} else {
$.cookie('mode','grid');
grid();
}
}
);
function grid(){
$('#mode').removeClass('flip');
$('#loop')
.fadeOut('fast', function(){
grid_update();
$(this).fadeIn('fast');
})
;
}
function list(){
$('#mode').addClass('flip');
$('#loop')
.fadeOut('fast', function(){
list_update();
$(this).fadeIn('fast');
})
;
}
function grid_update(){
$('#loop').addClass('grid').removeClass('list');
$('#loop').find('.thumb img').attr({'width': '190', 'height': '190'});
$('#loop').find('.post')
.mouseenter(function(){
$(this)
.css('background-color','FFEA97')
.find('.thumb').hide()
.css('z-index','-1');
})
.mouseleave(function(){
$(this)
.css('background-color','#f5f5f5')
.find('.thumb').show()
.css('z-index','1');
});
$('#loop').find('.post').click(function(){
location.href=$(this).find('h2 a').attr('href');
});
$.cookie('mode','grid');
}
function list_update(){
$('#loop').addClass('list').removeClass('grid');
$('#loop').find('.post').removeAttr('style').unbind('mouseenter').unbind('mouseleave');
$('#loop').find('.thumb img').attr({'width': '290', 'height': '290'});
$.cookie('mode', 'list');
}
Finally you will have to rotate the images/mode.png
by 180°
~That should do it. As you can see it worked for me.~