Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1415706

    Hi

    I have been building the following site at owe.brother.design for a client. They’ve requested that archive pages have an H1 header for accessibility signposting reasons. Eg. https://owe.brother.design/project_entries/enabling-infrastructure/ needs Enabling Infrastructure at the top and https://owe.brother.design/sites/becket-st-enabling-development/ needs Development Opportunities as H1 headers.

    I’m hoping you’ll able to help?

    Thanks in advance.

    Dominic

    #1415707

    Forgot password; see private content.

    #1415779

    Hi,
    Thanks for the link to your site. On both of your pages do you mean that you want the end of the breadcrumbs to be H1? This was the only place that I saw your terms Enabling Infrastructure, Development Opportunities.
    I think that adding a H1 to the breadcrumbs would make it look odd unless you plan to use css so it doesn’t have the standard H1 styling. But if you include the title with the breadcrumbs you will have these terms in H1 automatically.

    Best regards,
    Mike

    #1415798

    Hi Mike

    Not quite – I’d like to keep the breadcrumb as is but add an H1 heading between that and the post grid with the relevant heading title dynamically generated.

    I guess it would require tweaking the archive.php?

    Dominic

    #1415803

    I guess the difficulty is this:

    On the Theme settings under Header/Header Layout/Title and Breadcrumbs, I have “Show only breadcrumbs selected”. I want to show a Title only on archive pages. So I need to modify the archive.php to make this happen I think.

    Of course, I could change the setting under Header/Header Layout/Title and Breadcrumbs to show “header and breadcrumbs”, but that would mean manually selecting “breadcrumbs only” on every existing and future page, which isn’t great for management when the site is handed over to the client.

    So I think a tweak to archive.php in my child theme is the most sophisticated solution. Any thoughts on that and any ideas on what I change it to?

    Dominic

    #1415815

    Hi,
    If you only want the title to show on archive pages I would recommend selecting Enfold Theme Options ▸ Header ▸ Header Layout ▸ Header Title and Breadcrumbs and then use css to hide it from all page except archives, linke this:

    #top:not(.archive) .title_container .main-title.entry-title {
    	display: none;
    }

    Then I assume you will want to remove the text before the title on archive pages like Archive for category: , Tag Archive for: , Archive for: I recommend adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function remove_archive_title_pre_text() { ?>
      <script>
    (function($){
    $('#top.archive .title_container .main-title.entry-title a').contents().filter(function() {
      return this.nodeType == 3
    }).each(function(){
      this.textContent = this.textContent.replace('Archive for category:','');
      this.textContent = this.textContent.replace('Tag Archive for:','');
      this.textContent = this.textContent.replace('Archive for:','');
    });
    })(jQuery);
    </script>
      <?php
    }
    add_action('wp_footer', 'remove_archive_title_pre_text');

    Best regards,
    Mike

    #1415816

    Hi Mike
    I found another way – I created an archive.php in my child theme and added – <h1 class="h1-as-h3"><?php post_type_archive_title(); ?></h1> around line 35.

    Thanks for your help. I may come back and use this method if mine becomes problematic.

    Dominic

    • This reply was modified 1 year, 3 months ago by domchocolate.
    #1415840

    Hi,
    Glad to hear that you have this sorted out, 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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘H1 headings on Archive pages for Accessbility’ is closed to new replies.