-
AuthorPosts
-
October 13, 2020 at 10:26 am #1252502
Dear Great Enfold Support Team
A customer wishes the date info above the post title. I´m using the Advanced Lay-out Editor on this site: (please see private content) and BLOG: modern business.I found some support threads:
https://kriesi.at/support/topic/move-post-meta-data-below-post-title-2/#post-1072113
https://kriesi.at/support/topic/blog-posts-element-not-showing-date-meta-on-first-top-displayed-post/
and already managed to move the meta infos but couldn´t find the solution for my customer yet.I already included this to my functions.php:
How can this be done? Move Post Date: “date info above post title”
+++++++++++++++++++++++++++++++++++++
////————————-
// JS – Meta after title
// ————————
function metaAfterTitle(){
?>
<script>
jQuery(“.template-blog .post-entry”).each(function(i) {
var postTitle = jQuery(this).find(‘.blog-categories.minor-meta’);
var metaInfo = jQuery(this).find(‘.post-meta-infos’);
jQuery(metaInfo).insertAfter(postTitle);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘metaAfterTitle’);
+++++++++++++++++++++++++++++++++++++
and this to my custom.css
+++++++++++++++++++++++++++++++++++++
#top .post-meta-infos {
margin-top: -13px!important;
}
.html_elegant-blog .read-more-link {
font-size: 16px;
}
+++++++++++++++++++++++++++++++++++++October 13, 2020 at 11:59 am #1252517the one big error is that you do not enter the $(postTitle)
and to avoid to write always the jQuery instead of $ i do surround the code in this way – so you can use inside normal $ sign:<script> (function($){ … })(jQuery); </script>
and if you are not using any index you can remove that too:
( if your selectors are right – try this) :function metaAfterTitle(){ ?> <script> (function($){ $(".template-blog .post-entry").each(function(){ var postTitle = $(this).find('.blog-categories.minor-meta'); var metaInfo = $(this).find('.post-meta-infos'); $(metaInfo).insertAfter($(postTitle)); }); })(jQuery); </script> <?php } add_action('wp_footer', 'metaAfterTitle');
October 13, 2020 at 2:14 pm #1252532dear guenni007
why error?that´s my intention:
“A customer wishes the date info above the post title. I´m using the Advanced Lay-out Editor on this site: (please see private content) and BLOG: modern business.”
how can I manage this? was my question: “date info above the post title.”
any ideas?October 13, 2020 at 2:20 pm #1252533not that is the error – the error is in your syntax:
you Code is :
jQuery(metaInfo).insertAfter(postTitle);
and it has to be:
jQuery(metaInfo).insertAfter(jQuery(postTitle));
the other mentioned is only stylistic point of view. Instead of using on the whole code jQuery each time a $ is set – you can do it as said above.
October 13, 2020 at 2:27 pm #1252536This reply has been marked as private.October 13, 2020 at 2:38 pm #1252543i am a participant like you, and thats why i could not read private content area and if you prefer to hear it from a mod that needs to be improved in the code then that’s ok for me too.
You could have just tested the code – it wouldn’t have been that much work.
October 13, 2020 at 3:08 pm #1252550dear Guenni007 – sorry, it wasn´t meant rude – I thought you were from the support team :-)
Unfortunatly I can´t experiment with codes because the website is already live and the customer is really nervous
thank youOctober 13, 2020 at 5:06 pm #1252568you can test always – even each functions via Developer Tools and the Console
just open the concerning page/post and put the pure script to the console and press return.
see video:
VimeofilmOctober 13, 2020 at 5:15 pm #1252569If it has to be above the title – change the selector and insertBefore:
function metaAfterTitle(){ ?> <script> (function($){ $(".template-blog .post-entry").each(function(){ var postTitle = $(this).find('.av-heading-wrapper'); var metaInfo = $(this).find('.post-meta-infos'); $(metaInfo).insertBefore($(postTitle)); }); })(jQuery); </script> <?php } add_action('wp_footer', 'metaAfterTitle');
October 14, 2020 at 10:40 am #1252732Great dear guenni007
it works!
thank you so much for your supportThis thread can be closed :-)
October 17, 2020 at 2:18 pm #1253488Hi,
@KulturDesign glad to hear that @Guenni007 was able to assist, we will close that as requested, thanks for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Move Post: date info above post title’ is closed to new replies.