View Single Post
  #3  
Old March 7th, 2013, 05:54 AM
Aichels Aichels is offline
 
Join Date: Feb 2013
Posts: 77
Default

Hi,

1) My slider is called "Cycle" so went in editor and copied cycle.php. Is it right code?

<?php
global $post;
$pid = (isset($post->ID)) ? $post->ID : NULL;

if (is_home())
{
$pid = get_option("page_for_posts");
}
global $wp_query;
$current_term = $wp_query->get_queried_object();

// taxonomy page
if( (is_tax() || is_tag() || is_category()) && $current_term && get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider", true))
{
$slider_cat = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_cat", true);
$slider_count = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_count", true);
}
//post page
elseif( !is_tax() && !is_tag() && !is_category() && get_post_meta($pid, SHORTNAME . "_post_slider", true))
{
$slider_cat = get_post_meta($pid, SHORTNAME . "_post_slider_cat", true);
$slider_count = get_post_meta($pid, SHORTNAME . "_post_slider_count", true);
}
//global slideshow settings
elseif(is_post_type_archive( 'product' ) && $shop_page_id = get_shop_page_id())
{
$slider_cat = get_post_meta($shop_page_id, SHORTNAME . "_post_slider_cat", true);
$slider_count = get_post_meta($shop_page_id, SHORTNAME . "_post_slider_count", true);
}
else
{
$slider_cat = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::CATEGORY);
$slider_count = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::COUNT);
}

$args = array(
'post_type' => Custom_Posts_Type_Slideshow::POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => $slider_count,
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => Custom_Posts_Type_Slideshow::TAXONOMY,
'field' => 'slug',
'terms' => $slider_cat
)));

$slider_query = new WP_Query($args);

if ($slider_query->have_posts()) :
wp_enqueue_script('jcycle');

if( (is_tax() || is_tag() || is_category()) && $current_term && get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider", true))
{
$fx = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_effect", true);
$timeout = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_timeout", true);
$speed = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_speed", true);
$pause = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_pause", true);
$autoscroll = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_autoscroll", true);
$fixedheight= get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_fixedheight", true);
$padding = get_tax_meta($current_term->term_id, SHORTNAME . "_tax_slider_padding", true);

}
elseif( !is_tax() && !is_tag() && !is_category() && get_post_meta($pid, SHORTNAME . "_post_slider", true))
{
$fx = get_post_meta($pid, SHORTNAME . "_post_slider_effect", true);
$timeout = get_post_meta($pid, SHORTNAME . "_post_slider_timeout", true);
$speed = get_post_meta($pid, SHORTNAME . "_post_slider_speed", true);
$pause = get_post_meta($pid, SHORTNAME . "_post_slider_pause", true);
$autoscroll = get_post_meta($pid, SHORTNAME . "_post_slider_autoscroll", true);
$fixedheight= get_post_meta($pid, SHORTNAME . "_post_slider_fixedheight", true);
$padding = get_post_meta($pid, SHORTNAME . "_post_slider_padding", true);
}
else
{
$fx = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::EFFECT);
$timeout = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::TIMEOUT);
$speed = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::SPEED);
$pause = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::PAUSE);
$autoscroll = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::AUTOSCROLL);
$fixedheight= get_option(SHORTNAME . Admin_Theme_Item_Slideshow::FIXEDHEIGHT);
$padding = get_option(SHORTNAME . Admin_Theme_Item_Slideshow::PADDING);

}
?>
<script>
var slider_fx = '<?php echo $fx; ?>';
var slider_timeout = <?php echo $timeout; ?>;
var slider_speed = <?php echo $speed; ?>;
var slider_pause = <?php echo (int)!!$pause; ?>;
var autoscroll = <?php echo (int)!!$autoscroll; ?>;
var slider_fixedheight = <?php echo (preg_replace ( '/[^0-9]/', '', $fixedheight ))?preg_replace ( '/[^0-9]/', '', $fixedheight ):'420'; ?>;
var slider_padding = <?php echo (int)!!$padding; ?>;
</script>
<div class="jcycl_wrap">
<a class="jc-prev" href="#"><span>prev</span></a>
<a class="jc-next" href="#"><span>next</span></a>
<div id="jcyclemain">
<?php
while ($slider_query->have_posts()) : $slider_query->the_post();

$cycle_position = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_position", true) ) ? get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_position", true) : 'right';
$slider_title = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_title", true) ) ? get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_title", true) : NULL;
$slider_frame = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_frame", true) ) ? ' hide_frame' : NULL;
$link = (get_post_meta($post->ID, SHORTNAME . "_sliders_link", true) ) ? get_post_meta($post->ID, SHORTNAME . "_sliders_link", true) : NULL;
$btntxt = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_btntxt", true) ) ? get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_btntxt", true) : NULL;
$usebg = (get_post_meta($post->ID, SHORTNAME . "_slidebg", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg", true) : NULL;
$usebg_stretch = (get_post_meta($post->ID, SHORTNAME . "_slidebg_stretch", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg_stretch", true) : NULL;
$slidebg_width = (get_post_meta($post->ID, SHORTNAME . "_slidebg_width", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg_width", true) : NULL;
$slidebg_repeat = (get_post_meta($post->ID, SHORTNAME . "_slidebg_repeat", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg_repeat", true) : NULL;
$slidebg_positiony = (get_post_meta($post->ID, SHORTNAME . "_slidebg_positiony", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg_positiony", true) : NULL;
$slidebg_positionx = (get_post_meta($post->ID, SHORTNAME . "_slidebg_positionx", true) ) ? get_post_meta($post->ID, SHORTNAME . "_slidebg_positionx", true) : NULL;
$content_align = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_content_align", true) ) ? get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_content_align", true) : NULL;
$content_vertical = (get_post_meta($post->ID, SHORTNAME . "_sliders_cycle_content_vertical", true) ) ? 'content_vertical' : NULL;
$slideshow_height = (preg_replace ( '/[^0-9]/', '', $fixedheight ))?preg_replace ( '/[^0-9]/', '', $fixedheight ):'420';
$slidebg = NULL;

if(has_post_thumbnail()) :

$post_thumbnail_id = get_post_thumbnail_id( $post->ID );

$image_attributes = wp_get_attachment_image_src($post_thumbnail_id, 'full');

$slidebg = 'style="background-image:url('.$image_attributes[0].')" data-slidesize="'.$image_attributes[2].'"';
endif;
?>
<div class="jcyclemain <?php echo $cycle_position.$slider_frame.' ox_slide'.$post->ID; ?>" >
<?php if ($usebg_stretch){
wp_enqueue_script('anystretch');
?>
<script>jQuery(document).ready(function() {jQuery('.ox_slide<?php echo$post->ID; ?> .bgimage').appear(function() {jQuery('.ox_slide<?php echo$post->ID; ?> .bgimage').anystretch('<?php echo $image_attributes[0] ?>',{positionX:'left',positionY:'top'});});});</script>
<?php } ?>
<div class="bgimage <?php echo ($usebg)? $slidebg_width.' '.$slidebg_repeat.' '.$slidebg_positiony.' '.$slidebg_positionx: ''; ?>" <?php echo ($usebg)? $slidebg : ''; ?> >
<div class="row_wrapper">
<div class="row">
<?php
if (has_post_thumbnail($post->ID) && ($cycle_position == 'left'))
{
if (!$usebg){
echo '<div class="grid_7 cycle_image ' . $cycle_position . '"><div class="holder">';
if ($link)
{
echo '<a href="' . $link . '" >';
}
if ($slider_frame){
get_theme_post_thumbnail($post->ID, 'full');
} else {
//get_theme_post_thumbnail($post->ID, 'cycle_side');
get_theme_slideshow_thumbnail($post->ID, 510,$slideshow_height-73);
}
if ($link)
{
echo '</a>';
}
echo '</div></div>';
} else {
echo '<div class="grid_7" style="height:1px"></div>';
}
}
?>

<?php
if ($cycle_position == 'full' && !$usebg)
{

echo '<div class="grid_12 cycle_image ' . $cycle_position . '"><div class="holder">';
if ($link)
{
echo '<a href="' . $link . '" >';
}
//get_theme_post_thumbnail($post->ID, 'cycle_full');
get_theme_slideshow_thumbnail($post->ID, 920,$slideshow_height-73);
if ($link)
{
echo '</a>';
}
echo '</div></div>';
}
else
{
?>

<div class="cycle_content cycle_col <?php echo ($cycle_position == 'empty' ) ? 'grid_12' : 'grid_5'; echo ' '.$content_align.' '.$content_vertical;?>">

<?php
if (!$slider_title)
{
?>
<h3 class="entry-title">
<?php the_title(); ?>
</h3>
<?php } ?>
<div class="entry-content">
<?php
global $more;
$more = 1;
the_content();

?>
</div>


</div>
<?php } ?>
<?php
if (has_post_thumbnail($post->ID) && ($cycle_position == 'right'))
{
if (!$usebg) {
echo '<div class="grid_7 cycle_image ' . $cycle_position . '"><div class="holder">';
if ($link)
{
echo '<a href="' . $link . '" >';
}
if ($slider_frame){
get_theme_post_thumbnail($post->ID, 'full');
} else {
//get_theme_post_thumbnail($post->ID, 'cycle_side');
get_theme_slideshow_thumbnail($post->ID, 510,$slideshow_height-73);
}
if ($link)
{
echo '</a>';
}
echo '</div></div>';
} else {
echo '<div class="grid_7" style="height:1px"></div>';
}
}
?><div class="clear"></div>
</div>
</div>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
</div>
<div id="navcycle"><span></span></div>
<?php endif; ?>


2) Thank you, this worked perfectly.

3) [IMG] https://docs.google.com/file/d/0BysN...Vpc1JPUVE/edit [/IMG] As I understood this problem is because I changed h2 and h6 tags.

4) Thank you.

5) Store front page and category page.

Actually what I'm trying to reach here is to make my store look like here www.fashion-drop.com now it looks like here http://www.fashion-drop.com/store . So all I need is to increase image size, give them small frame with white background and move title next to add to cart button, that's it. Can you please help with that?

Last edited by Aichels : March 7th, 2013 at 06:05 AM.