Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   Datafeedr + theme shortcodes (/showthread.php?t=8877)

Aichels March 29th, 2013 09:18 AM

Datafeedr + theme shortcodes
 
Hi,

My theme has nice shortcodes and I would like to add blog shortcode, like in this example ( http://simplicitywp.olegnax.com/shor...log-shortcode/ ) just above my products only in my homepage. Obviously adding text module and inserting shortcode won't work, but is there anything I could do to display my latest three blog posts above products in homepage?

Another question is - I have slider in my homepage, but it is showing in all my store pages. Is there way to show slider only chosen pages or choose which slider to show in which page?

Thank you,

Store: www.fashion-drop.com

Eric March 29th, 2013 09:28 AM

Hi,

You can add a shortcode to a Text module on your Store's Front Page view. But you will need to add the shortcode within a PHP function. Here's more on how to do that: http://codex.wordpress.org/Function_...e/do_shortcode

You will need to ask your theme's developers how to hide/show your slider on different pages. That's outside of the scope of support we're able to provide. One thing you should make sure of though is that you've not chosen "Store" as "Front page displays" here: WordPress Admin Area > Settings > Reading.

Eric

Aichels March 29th, 2013 09:47 AM

Great! I used <?php echo do_shortcode('[blog category="215" perpage="3" ]'); ?> and hat worked.

Thank you.

Aichels March 29th, 2013 10:00 AM

About slider - in theme options I can choose in which page I want to display my slider but Datafeedr store is only one page, so If I disable there it disable slider also in homepage. In settings my homepage is Home.

I'm now wondering how datafeedr is creating pages if I don't see them in pages or posts or categories? I like to have slider in frist page, but to keep it in every page is unnecessary and slows down page.

Eric March 29th, 2013 10:14 AM

Hi,

Can you post the code from your theme that displays the slider. Then I can add a conditional to the code so it only shows on your store's front page.

Eric

Aichels March 29th, 2013 10:29 AM

I think this is code form me slider.

<?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;
if (!is_dfr()) { 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; ?>

Eric March 29th, 2013 10:37 AM

Hi,

I'm not sure if this will work but you could try changing the first few lines of that file to this:

PHP Code:

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

// [NEW] Don't show anything if not on the Store's front page
if (!is_dfr('home')) {
    return;
}
// end [NEW]

Eric

Aichels March 29th, 2013 10:49 AM

No it'd didn't work, it broke all website.

Eric March 29th, 2013 10:52 AM

Can you paste in the code that include()s or require()s that file?

Aichels March 29th, 2013 12:08 PM

Sorry I'm not developer. :) So just have basic knowledge.

What do you mean with "code that include()s or require()s that file"?

Eric March 29th, 2013 12:11 PM

Hi

Can you PM me the following information:

BLOG LOGIN INFO with ADMINISTRATOR PERMISSIONS (Temporary login information preferred)
Admin URL:
Username:
Password:

Thanks,
Eric

Aichels March 29th, 2013 12:29 PM

Login info sent.

Thank you very much

Eric March 29th, 2013 12:38 PM

Hi,

Doing what I mentioned here /show...1029#post41029 worked for me. Now the slider only appears on your homepage.

Eric

Aichels March 29th, 2013 01:34 PM

Sorry, like I said - I'm not developer, so probably pasted that code wrong place or something.

Thank you for help.

Eric March 29th, 2013 02:19 PM

Quote:

Originally Posted by Aichels (Post 41044)
Sorry, like I said - I'm not developer, so probably pasted that code wrong place or something.

Thank you for help.

No problem. Glad it worked.


All times are GMT -5. The time now is 01:15 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.