0

I am webdesigner that knows some basic CSS and HTML. I never worked with PHP and I don't know how to handle this problem but I think it's fairly easy... Well I hope.

This is the code:

<?php

if ( ! $related && $single ) {
    echo '<h2 class="post-title page-title">';
    the_title();
    echo '</h2>';
} else {
    echo '<h3 class="post-title"><a href="' . esc_url( get_the_permalink() ) . '">';
    the_title();
    echo '</a></h3>';
}

I just want to override it in the Child functions.php so that the H2 will be a H1 for SEO reasons. Can anyone help me on the right track?

Greetings and thanks in advance, Pim van Delft

3
  • where is the code you shared located in your main theme? And is it inside a function or filter? Or is it in a template file?
    – Tom J Nowell
    Aug 11, 2022 at 19:31
  • Thanks for trying to help me out. It's inside a template file. templates > posts > post-title.php Aug 11, 2022 at 19:39
  • is that the folder it's in? In a child theme you create a copy of the file from the parent theme in the same location and it should use that instead, but that only works if it is indeed a template loaded via the WordPress theming system. If it is not, then it's bad news and you'll be forced to ask the theme authors for help as the answer will be unique and specific to the theme.
    – Tom J Nowell
    Aug 11, 2022 at 22:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.