-
AuthorPosts
-
January 10, 2024 at 9:58 am #1429692
Hi,
I need the masonry blocks not to show H3 titles by default. I have consulted the forum and there is a script to insert on each page but I need to change all the masonrys on my site at once. How can I do it? Thanks
January 10, 2024 at 11:21 am #1429702Hey keep12,
Thank you for the inquiry.
Are you trying to replace h3 with another tag? Please try this script in the functions.php file.
function ava_custom_script_c() { ?> <script> (function($) { $(document).ready(function () { // replace h3 with h2 $('h3.av-masonry-entry-title').replaceWith(function() { return $('<h2>', { class: $(this).attr('class'), itemprop: $(this).attr('itemprop'), html: $(this).html() }); }); }); }(jQuery)); </script> <?php } add_action('wp_footer', 'ava_custom_script_c');
This script will convert all elements with the class “av-masonry-entry-title” from < h3 > to < h2 >.
Best regards,
IsmaelJanuary 10, 2024 at 1:54 pm #1429719Hi Ismael,
Thanks for your quick reply. Actually what I need is to change them to H6, so I will change that in the script you suggest.
Best regards!
January 11, 2024 at 6:48 am #1429773Hi keep12,
I’m glad that Ismael could help you :)
Just let us know if you still need further assistance.Best regards,
NikkoJanuary 11, 2024 at 7:59 am #1429781or – instead of replacing it afterwards – use the filter avf_customize_heading_settings to influence the generation of those headings:
function my_customized_headings_for_masonry_titles( array $args, $context, array $extra_args = array() ) { if( $context == 'avia_masonry' ){ $args['heading'] = 'h6'; } return $args; } add_filter( 'avf_customize_heading_settings', 'my_customized_headings_for_masonry_titles', 10, 3 );
January 11, 2024 at 9:33 am #1429796January 11, 2024 at 1:22 pm #1429811Hello,
The file functions.php is the one that is in /public_html/wp-includes, right?
Thanks
January 11, 2024 at 1:43 pm #1429812Hello,
Thank you very much for your contribution, @Guenni007! The problem has been finally solved.
Best regards!
January 11, 2024 at 4:26 pm #1429820The functions.php is located directly in the root directory of the theme. However, if you are working without a child theme, there are a few things to consider for the parent theme. That’s why I recommend always working with a child theme: changed settings / customizations will not be lost with the next update.
January 12, 2024 at 1:28 am #1429843Hi keep12,
If you aren’t using a child theme yet you can download it here: https://kriesi.at/documentation/enfold/child-theme/
Or you also have the option to use a plugin like WPCodeBest regards,
NikkoJanuary 15, 2024 at 4:35 pm #1430174Hello guys,
We are using enfold child theme. But i injected the script throw the function.php file.
Thanks
January 15, 2024 at 6:57 pm #1430182if you are using the child-theme from enfold download page there was an empty functions.php file included.
on default you can reach the editor of that file via dashboard – Appearance – Theme File Editor
on the right side you can see the files that are included in your child-theme folder. Click on functions.php and see.
Do not erase that first line:<?php
after this line you can insert the shortcode snippets.
January 16, 2024 at 9:35 am #1430203January 16, 2024 at 11:39 am #1430237Thank you very much,
We are going to inject the script code throw the ftp to the enfold child theme.
Thanks :D
January 16, 2024 at 5:44 pm #1430741 -
AuthorPosts
- You must be logged in to reply to this topic.