Hi,
I would like change the post layout.
Put the categories between the text and read more. (attach image)
Could you help me?
Thanks Advance,
BR,
Antonio.
Hey Antonio,
Thank you for the link to your site and the screenshot, try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
function article_categories_before_read_more() { ?>
<script>
(function($){
$('article.post-entry').each(function() {
$( this ).find('.blog-categories.minor-meta').insertBefore($(this).find('.read-more-link'));
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'article_categories_before_read_more');
Best regards,
Mike
Hi Mike,
I have added but it not works.
Thanks advance
BR,
Antonio.
Hi,
Thanks for the feedback, I see that you are getting this error: Uncaught ReferenceError: jQuery is not defined
typically this means that you are loading jQuery in your footer, try this script instead in your child theme functions.php
function article_categories_before_read_more() { ?>
<script>
window.addEventListener('DOMContentLoaded', function() {
(function($){
$('article.post-entry').each(function() {
$( this ).find('.blog-categories.minor-meta').insertBefore($(this).find('.read-more-link'));
});
})(jQuery);
});
</script>
<?php
}
add_action('wp_footer', 'article_categories_before_read_more');
Best regards,
Mike
Hi Mike,
Works perfectly! Many thanks for your help and explanations.
BR,
Antonio.
Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike