Tagged: jQuery
Follow up of the ticket “Move author and date at the beginning of the article”
https://kriesi.at/support/topic/move-author-and-date-at-the-beginning-of-the-article/
the code given in https://kriesi.at/support/topic/move-author-and-date-at-the-beginning-of-the-article/#post-1361966
is moving correctly post-meta-info to the top but is giving error:
—————-
jquery.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading ‘indexOf’)
at S.fn.load (jquery.min.js:2:84932)
at (index):1094:17
—————-
We are on a powerful and fast server and jQuery is loaded as the first js file
The script is
<script>
jQuery(window).load(function(){
jQuery( “.single.single-post .post-meta-infos” ).insertBefore(‘.entry-content’ );
}());
</script>
Thank you
Mauro
Hey profumopuntoit,
Try this function instead:
function move_postmeta(){
?>
<script>
window.addEventListener('DOMContentLoaded', function() {
(function($){
$( ".single.single-post .post-meta-infos" ).insertBefore('.entry-content' );
})(jQuery);
});
</script>
<?php
}
add_action('wp_footer', 'move_postmeta');
Best regards,
Mike
Thank you Mike, now it works correctly without errors
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