-
AuthorPosts
-
June 9, 2021 at 3:58 am #1304767
Hello,
I placed the “Blog Posts” element in the homepage to show the last posts published ( https://gyazo.com/69475b8f68d1dd765080568a6ab99be1 ).
The titles of the last posts are in h2 ( https://gyazo.com/fb97927225650f33f9d6fd117ba5e9a9 )
Can you please give me the code to place in the functions.php to change them from “h2” to “p” (paragraph)?
Also, I see an h5 in the “Social share” element that I want to change to “p” ( https://gyazo.com/2e3d64c07667b774286dc548e3416e68 )
If you can provide me both codes it will be great.
Thanks! :)
June 11, 2021 at 1:22 pm #1305268Hey Alessandro,
Thank you for your patience and thanks for the link and screenshots, the h5 in the “Social share” element already seems to be a “p”, so I assume you already figured this one out, for the h2 titles on your blog page try adding this code to the end of your functions.php file in Appearance > Editor:function custom_script() { ?> <script> (function($) { $(document).ready(function(){ function replaceElementTag(targetSelector, newTagString) { $(targetSelector).each(function(){ var newElem = $(newTagString, {html: $(this).html()}); $.each(this.attributes, function() { newElem.attr(this.name, this.value); }); $(this).replaceWith(newElem); }); } replaceElementTag('h2.post-title.entry-title', '<p></p>'); }); }(jQuery)); </script> <?php } add_action('wp_footer', 'custom_script');
Best regards,
MikeJune 12, 2021 at 4:05 am #1305337Hello, thanks a lot!
It worked, but I notice that the titles are still showing up in the table of contents: https://gyazo.com/0fd0d4a53a533066acd3e5c6104df6e9
Is there a way to get them out from the TOC?
Thanks a lot again!
Best Regards,
Alex.
June 12, 2021 at 6:31 pm #1305414Hi,
How are you achieving the TOC, it doesn’t look like one of our elements?Best regards,
MikeJune 13, 2021 at 3:05 am #1305428Hi Mike,
Nope. It’s the Table and contents plus plugin creating the TOC ( https://it.wordpress.org/plugins/table-of-contents-plus/ ).
June 13, 2021 at 4:20 pm #1305463Hi,
I see, it looks like the plugin is getting it’s info before the script runs and I don’t see any classes in the TOC links to identify the ones to remove. If your TOCs are not going to be changing in the future, you could copy the source code of each one, edit out the ones you don’t want and then paste into a code block element, and remove the plugin.
Otherwise, it looks like your plugin will allow exclusions
you will need to figure out keywords that you don’t want to be included, the plugin also lets you deactivate for pages or posts, so perhaps that would help, or perhaps there is another plugin that will give you more options.
I can’t read your language so I can’t get a good idea of what you want to show or not, or what your page content is aiming for, so I’m not a lot of help there, sorry.Best regards,
MikeJune 14, 2021 at 3:40 am #1305484Hi Mike, thanks a lot for your time! You’ve been awesome. Really appreciated.
I’ll try my best to get it fixed. Otherwise I’ll leave as it is. It’s not a big problem.
Yeah… I can’t ready Thai language too 😅 and it might be a part of the problem for the plugins/wordpress decoding the letters.
Thanks again,
Best Regards,
Alessandro.
- This reply was modified 3 years, 6 months ago by ProMarketer.
June 14, 2021 at 11:39 am #1305570Hi,
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 -
AuthorPosts
- The topic ‘Change "Blog Posts" last post heading from "h2" to "p"’ is closed to new replies.