Change post meta data

Hello

I would like to know where to edit what appears in the post meta data area. Specifically I’d like to add a sentence that would appear under every post. But I don’t like having it at the top of the post text as it then is the first sentence of the except.

Thank you

Jeff

Hello there,

Please try doing these steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
    ;(function($) {

      $('.post.hentry').each(function(){

        var postMeta = $(this).find('.entry-meta');
        var summary  = $(this).find('.entry-summary');

        if(postMeta.length) {
          postMeta.addClass('clearfix').css('clear', 'both');
          postMeta.remove().clone().insertAfter(summary);
        }

      });

    })(jQuery);

4 . Update

Regards,
Kharis

Thanks Kharis

I did those things but am unclear on where to go to add the custom text.

Thanks

Jeff

Hello Jeff,

I am sorry, not sure if it’s achievable. But, let me ask one thing: is it dynamic text or all meta data has the same extra text?

Regards,
Kharis

Hi Kharis

Specifically what I wanted to do was have 1 sentence appear below every post title where the meta data appears showing category and post date. It would be the same sentence for every post and ideally I would be able to use HTML to have a link in it.

To be specific, take a look at this website (nothing to do with me): https://wellkeptwallet.com/make-30-fast/

The sentence I’m talking about would be very similar to their sentence “Some of the links included in this post are from our sponsors. Read our disclosure policy.” that appears just below the post title.

Hope that helps clarify what I’m trying to do.

I don’t want it to appear in the excerpt which is why a sub-title plug in doesn’t work nor does it work to just have that be at the top of the post text.

Thanks

Jeff

Try using this jQuery code and add it to TC Custom JavaScript.

    (function($){

      var customHtml = '<div style="margin-bottom:20px;"><em>My text and <a href="#">link</a></em></div>';
      $('.hentry .entry-header').append(customHtml);

    })(jQuery);

Regards,
Kharis

Hi Kharis

Unfortunately that didn’t work. I added my custom sentence. I also tried it with and without the original java code you gave me.

Any other ideas?

Thanks

Jeff

Hello Jeff,

I noticed your site has been cached, which potentially can’t take the new code additions to take an immediate effect unless it’s flushed. Please flush the applied cache and try again.

Regards,
Kharis

Hi Kharis

I cleared the cache but still don’t see it on the posts.

Thanks

Jeff

Hello Jeff,

Your custom text which contains a single quote, for example as in “it’s” breaks the JS variable. You should use this one instead:

    (function($){

      var customHtml = '<div style="margin-bottom:20px;"><em>This post, like many of my posts, may contain affiliate links. Affiliate links don\'t increase the cost to you, but they do pay the site a small commission for sending you to them. Thus it\'s a great way to get what you want and say thank you to us! Just click for more on my <a href="https://newmiddleclassdad.com/affiliate-disclaimer/">affiliate policy</a></em></div>';
      $('.hentry .entry-header').append(customHtml);

    })(jQuery);

Regards,
Kharis

That works! However it takes up the majority of the excepts. Is there a way to exclude it from the excerpt and maybe shrink the font size a little?

Thanks!

Jeff

Hello there,

Please edit this line of code:

<div style="margin-bottom:20px;"> 

becomes like this to add font size inline style:

<div style="margin-bottom:20px; font-size:80%;">

You can also use a fixed px value for example: font-size: 12px;

Regards,
Kharis

Perfect!

Thanks so much!

Jeff

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis