PiXeL2013
Forum Replies Created
-
Forum: Plugins
In reply to: [Perfect Images: Regenerate Thumbnails, Image Sizes, WebP & AVIF] New ImagesI am using the Avada theme. If you look at their demo here – http://themeforest.net/item/avada-responsive-multipurpose-theme/full_screen_preview/2833226 you’ll see under “Recent Work” there is a slider. On mouseover of any of the graphics within the slider, several images appear including a link icon and a magnifying glass icon. I have replaced the link icon with a customized version on my own site. I have also created a @2x version that is retina-ready and uploaded that via FTP. When viewed in a mobile device, only the regular image appears and not the retina-ready version.
I am thinking this may be related to your FAQ item relating to sliders or the fact that it is not in the media library. If this is the case, I am unable to determine where to insert
$(‘img’).each(function(){
new RetinaImage(this);
});Recent Works widget code below:
<?php
add_action(‘widgets_init’, ‘recent_works_load_widgets’);function recent_works_load_widgets()
{
register_widget(‘Recent_Works_Widget’);
}class Recent_Works_Widget extends WP_Widget {
function Recent_Works_Widget()
{
$widget_ops = array(‘classname’ => ‘recent_works’, ‘description’ => ‘Recent works from the portfolio.’);$control_ops = array(‘id_base’ => ‘recent_works-widget’);
$this->WP_Widget(‘recent_works-widget’, ‘Avada: Recent Works’, $widget_ops, $control_ops);
}function widget($args, $instance)
{
extract($args);
$title = apply_filters(‘widget_title’, $instance[‘title’]);
$number = $instance[‘number’];echo $before_widget;
if($title) {
echo $before_title . $title . $after_title;
}
?>
<div class=”recent-works-items clearfix”>
<?php
$args = array(
‘post_type’ => ‘avada_portfolio’,
‘posts_per_page’ => $number
);
$portfolio = new WP_Query($args);
if($portfolio->have_posts()):
?>
<?php while($portfolio->have_posts()): $portfolio->the_post(); ?>
<?php if(has_post_thumbnail()): ?>
” title=”<?php the_title(); ?>”>
<?php the_post_thumbnail(‘recent-works-thumbnail’); ?>
<?php endif; endwhile; endif; ?>
</div><?php echo $after_widget;
}function update($new_instance, $old_instance)
{
$instance = $old_instance;$instance[‘title’] = strip_tags($new_instance[‘title’]);
$instance[‘number’] = $new_instance[‘number’];return $instance;
}function form($instance)
{
$defaults = array(‘title’ => ‘Recent Works’, ‘number’ => 6);
$instance = wp_parse_args((array) $instance, $defaults); ?>
<p>
<label for=”<?php echo $this->get_field_id(‘title’); ?>”>Title:</label>
<input class=”widefat” style=”width: 216px;” id=”<?php echo $this->get_field_id(‘title’); ?>” name=”<?php echo $this->get_field_name(‘title’); ?>” value=”<?php echo $instance[‘title’]; ?>” />
</p><p>
<label for=”<?php echo $this->get_field_id(‘number’); ?>”>Number of items to show:</label>
<input class=”widefat” style=”width: 30px;” id=”<?php echo $this->get_field_id(‘number’); ?>” name=”<?php echo $this->get_field_name(‘number’); ?>” value=”<?php echo $instance[‘number’]; ?>” />
</p>
<?php
}
}
?>