| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www/wp-content/plugins/divi-pixel/public/partials/ |
Upload File : |
<?php
namespace DiviPixel;
$blog_related_box_column = DIPI_Public::get_option('blog_related_box_column', '3');
$blog_related_box_hover_effect = DIPI_Public::get_option('blog_related_box_hover_effect');
$blog_related_image_hover_effect = DIPI_Public::get_option('blog_related_image_hover_effect');
$blog_related_title_position = DIPI_Public::get_option('blog_related_title_position', 0);
$dipi_related_articles_limit = get_option('dipi_related_articles_limit');
$blog_related_icon_effect = DIPI_Public::get_option('blog_related_icon_effect');
// Box hover
$dipi_box_hover_effect_class = '';
if( 'zoomin' === $blog_related_box_hover_effect) :
$dipi_box_hover_effect_class = 'dipi-zoom-in';
elseif( 'zoomout' === $blog_related_box_hover_effect) :
$dipi_box_hover_effect_class = 'dipi-zoom-out';
elseif( 'moveup' === $blog_related_box_hover_effect) :
$dipi_box_hover_effect_class = 'dipi-move-up';
endif;
// Image hover
$dipi_image_hover_effect_class = '';
if( 'zoomin' === $blog_related_image_hover_effect) :
$dipi_image_hover_effect_class = 'dipi-zoom-in';
elseif( 'zoomout' === $blog_related_image_hover_effect) :
$dipi_image_hover_effect_class = 'dipi-zoom-out';
elseif( 'zoomrotate' === $blog_related_image_hover_effect) :
$dipi_image_hover_effect_class = 'dipi-zoom-rotate';
endif;
// Swtich title position
$dipi_switch_title_class = '';
if( !$blog_related_title_position ) :
$dipi_switch_title_class = 'dipi-content-over-image';
else :
$dipi_switch_title_class = 'dipi-content-bottom-image';
endif;
//Effect
$dipi_icon_effect_class = '';
if( 'always' === $blog_related_icon_effect) :
$dipi_icon_effect_class = 'dipi-icon-always';
elseif( 'onhover' === $blog_related_icon_effect) :
$dipi_icon_effect_class = 'dipi-icon-onhover';
elseif( 'hideonhover' === $blog_related_icon_effect) :
$dipi_icon_effect_class = 'dipi-icon-hideonhover';
endif;
// Limit
$dipi_related_articles_limit = (is_numeric($dipi_related_articles_limit)) ? $dipi_related_articles_limit : '6';
global $post;
$index = 0;
$args = array();
$options = array(
'post_id' => !empty($post) ? $post->ID : '',
'taxonomy' => 'category',
'post_type' => 'post',
'orderby' => 'date',
'limit' => $dipi_related_articles_limit,
'order' => 'DESC'
);
$args = wp_parse_args($args, $options);
if (!taxonomy_exists( $args['taxonomy'] ) ) {
return;
}
$taxonomies = wp_get_post_terms($args['post_id'], $args['taxonomy'], array('fields' => 'ids'));
if (!isset($taxonomies)) {
return;
}
// query
$related_posts = get_posts(array(
'post__not_in' => (array) $args['post_id'],
'post_type' => $args['post_type'],
'tax_query' => array(
array(
'taxonomy' => $args['taxonomy'],
'field' => 'term_id',
'terms' => $taxonomies
),
),
'posts_per_page' => $args['limit'],
'orderby' => $args['orderby'],
'order' => $args['order']
));
$related_articles_heading = get_option('dipi_related_articles_heading');
$related_articles_heading = (!empty($related_articles_heading)) ? $related_articles_heading : esc_html__('Related Articles', 'dipi-divi-pixel');
?>
<div class="dipi-related-articles">
<h3 class="dipi-related-section-articles-title">
<?php echo esc_html( $related_articles_heading ); ?>
</h3>
<div class="dipi-related-articles-row">
<?php foreach ($related_posts as $post) {
setup_postdata($post);
if( $index % $blog_related_box_column == 0 && $index != 0) :
echo '</div><div class="dipi-related-articles-row">';
endif;
?>
<div class="dipi-related-article-column dipi-column-<?php echo $blog_related_box_column; ?> <?php echo $dipi_box_hover_effect_class; ?>">
<div class="dipi-related-article-content">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php if (has_post_thumbnail()) { ?>
<div class="dipi-related-article-thumb-wrap">
<div class="dipi-related-article-thumb <?php echo $dipi_image_hover_effect_class; ?>">
<?php echo get_the_post_thumbnail( null, 'full', array( 'alt' => the_title_attribute( array('echo' => false) ) ) ); ?>
<div class="dipi-image-overlay"></div>
</div>
</div>
<?php } else { ?>
<div class="dipi-related-article-thumb-wrap">
<div class="dipi-related-article-thumb <?php echo $dipi_image_hover_effect_class; ?>">
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTA4MCIgaGVpZ2h0PSI1NDAiIHZpZXdCb3g9IjAgMCAxMDgwIDU0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZmlsbD0iI0VCRUJFQiIgZD0iTTAgMGgxMDgwdjU0MEgweiIvPgogICAgICAgIDxwYXRoIGQ9Ik00NDUuNjQ5IDU0MGgtOTguOTk1TDE0NC42NDkgMzM3Ljk5NSAwIDQ4Mi42NDR2LTk4Ljk5NWwxMTYuMzY1LTExNi4zNjVjMTUuNjItMTUuNjIgNDAuOTQ3LTE1LjYyIDU2LjU2OCAwTDQ0NS42NSA1NDB6IiBmaWxsLW9wYWNpdHk9Ii4xIiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz4KICAgICAgICA8Y2lyY2xlIGZpbGwtb3BhY2l0eT0iLjA1IiBmaWxsPSIjMDAwIiBjeD0iMzMxIiBjeT0iMTQ4IiByPSI3MCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMDgwIDM3OXYxMTMuMTM3TDcyOC4xNjIgMTQwLjMgMzI4LjQ2MiA1NDBIMjE1LjMyNEw2OTkuODc4IDU1LjQ0NmMxNS42Mi0xNS42MiA0MC45NDgtMTUuNjIgNTYuNTY4IDBMMTA4MCAzNzl6IiBmaWxsLW9wYWNpdHk9Ii4yIiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz4KICAgIDwvZz4KPC9zdmc+Cg==" alt="">
<div class="dipi-image-overlay"></div>
</div>
</div>
<?php } ?>
<div class="dipi-related-article-bottom <?php echo $dipi_switch_title_class; ?>">
<h4 class="dipi-related-article-title">
<?php the_title(); ?>
</h4>
<?php if(
'always' === $blog_related_icon_effect ||
'onhover' === $blog_related_icon_effect ||
'hideonhover' === $blog_related_icon_effect
) : ?>
<div class="dipi-related-article-arrow <?php echo $dipi_icon_effect_class; ?>">
<span class="et_pb_font_icon dipi-readmore-arrow"></span>
</div>
<?php endif; ?>
</div>
</a>
</div>
</div>
<?php $index++; } ?>
</div>
</div>
<?php
wp_reset_postdata();