• Resolved aintnosin

    (@aintnosin)


    I want to modify the html output around the post title so I could change heading tag and/or add classes.

    If the default is like this:

    <h2 class="entry-title">The Title Goes Here!</h2>

    I’d like to change it to this:

    <h3 class="entry-title level-2">The Title Goes Here!<h3>

    I could do this with a custom template tag, but I would prefer to to with a filter and relieve the users of the need of editing their theme template files. Is that possible?

    ‘the_title’ filter just modifies the text inside the HTML tags.

Viewing 3 replies - 1 through 3 (of 3 total)
  • there is generally no filter hook on any html tags in a template;

    you could however consider to use ‘the_title’ filter to nest a span with CSS class within the html tags – like <h3 class="entry-title"><soan class="level-2">The Title Goes Here!</span><h3>.

    Thread Starter aintnosin

    (@aintnosin)

    Thanks. Thought that might be the case. Thought there might be a chance to intercept the final output and apply a regex to replace the tags before wordpress sent it out.

    Thread Starter aintnosin

    (@aintnosin)

    Thank you for hte help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change the HTML around the post title with a filter…’ is closed to new replies.