Problem after enfold theme update. Timeline content element is displayed incorrectly on small screens. Every second date is missing. https://diraweb.de/blog/
WP 6.8
enfold 7.1
php 8.1
Thx
Hey diraastro,
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
function change_the_order_of_milestone_even_on_mobile_screens() { ?>
<script>
document.addEventListener('DOMContentLoaded', () => {
const milestones = document.querySelectorAll('.av-milestone-even');
if (milestones.length === 0) return;
const mediaQuery = window.matchMedia('(max-width: 989px)');
const reorderMilestones = () => {
if (mediaQuery.matches) {
milestones.forEach(milestone => {
const date = milestone.querySelector('.av-milestone-date');
const icon = milestone.querySelector('.av-milestone-icon-wrap');
const content = milestone.querySelector('.av-milestone-content-wrap');
if (date && icon && content) {
milestone.innerHTML = '';
milestone.appendChild(date);
milestone.appendChild(icon);
milestone.appendChild(content);
}
});
}
};
reorderMilestones();
mediaQuery.addEventListener('change', reorderMilestones);
});
</script>
<?php
}
add_action( 'wp_footer', 'change_the_order_of_milestone_even_on_mobile_screens', 99 );
Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
If you are not using a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
and ensure that it is activated, then add the above code and save.
Best regards,
Mike