Viewing 6 replies - 1 through 6 (of 6 total)
  • I’ve requested this too. Hopefully it can become a toggle option.

    Thread Starter elr3000

    (@elr3000)

    Just to clarify what I am requesting, if an article has the title “The Pacific Ocean”, we would like to find a way that they can be found under the letter “P”.

    An option that says “Ignore ‘The’ at the start of titles” would be nice, but in our case we would really like to have it displayed under both “P” and “T”.

    Yes, what you’re describing is what I want too. Listed under both.

    Also, generally speaking, if there could be a way to exclude terms, would it be any different to make excluding any terms possible? And why not include too (prepend/append/before/after)?

    Has this been resolved yet? I would like to use this option too. I saw a post where the developer mentioned editing the PHP. I would be happy to do that if I knew what to add and where?

    Searching for the answer to this I found a plugin developer talking about his plugin and he shared that if

    title_divider=”The”

    was added to the shortcode it would do what we have asked for so would a similar solution work here?

    Regards
    MinkiSan

    Thread Starter elr3000

    (@elr3000)

    Well I’ve had no reply from dev in 3 months. Either they’re not monitoring this support forum, or they don’t care.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Ignoring “the” or adding an extra index entry for the first letter of the subsequent word after “the” will require you do do some PHP coding. There is a filter called a_z_listing_item_index_letter that returns the letter(s) you want the item indexed under. This does not affect the sorting inside each letter section, so all the titles beginning with “The” in the T section will be grouped together.

    Your filter will want to look similar to:

    add_filter( 'a_z_listing_item_index_letter', 'add_extra_a_z_entry_for_titles_beginning_with_the', 10, 3 );
    function add_extra_a_z_entry_for_titles_beginning_with_the( $indices, $item, $display) {
        $title = apply_filters( "a_z_listing_get_item_title_for_display__{$display}", '', $item );
        $title_parts = explode( ' ', $title );
        if ( preg_match ( '^The$', $title_parts[0], 'i' ) && count( $title_parts ) > 1 ) {
            // this line adds an extra index entry..
            $indices[] = mb_substr( $title_parts[1], 0, 1 );
            // this line replaces the existing index entry, for ignoring The entirely..
            // $indices = array( mb_substr( $title_parts[1], 0, 1 ) );
        }
        return $indices;
    }

    Note this is a quick rough draft and will likely be broken – it is indended to be a jumping-off point for you to expand upon.

    • This reply was modified 2 years, 8 months ago by Dani Llewellyn. Reason: Add ignoring The in titles as an extra example
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Ignoring words in page titles such as those starting with “The…”’ is closed to new replies.