{"id":2269,"date":"2026-10-20T08:29:35","date_gmt":"2026-10-20T07:29:35","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/shorten-breadcrumb-on-listing-pages\/"},"modified":"2026-10-20T08:41:01","modified_gmt":"2026-10-20T07:41:01","slug":"shorten-breadcrumb-on-listing-pages","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/shorten-breadcrumb-on-listing-pages\/","title":{"rendered":"How to shorten the breadcrumb on GeoDirectory listing pages"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GeoDirectory does not print a breadcrumb of its own. The breadcrumb you see on a listing page comes from your theme or from an SEO plugin such as Yoast SEO or Rank Math, and the last item is the listing title. A long title makes a long breadcrumb, so there are two ways to shorten it: cut the text with CSS, or shorten the title only inside the breadcrumb with a small filter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Shorten it with CSS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CSS can cut the last item to a fixed width and add an ellipsis. The listing title on the page stays as it is. Add this at Appearance &gt; Customize &gt; Additional CSS and change the class to match your breadcrumb. <code>.breadcrumb_last<\/code> is the class Yoast SEO gives the last item.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-css\">.breadcrumb_last {\n    display: inline-block;\n    max-width: 250px;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    vertical-align: bottom;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your theme prints the breadcrumb, use your browser&#8217;s inspect tool on the last item to find its class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Shorten the breadcrumb text with Yoast SEO<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GeoDirectory already hooks into the Yoast breadcrumb to add the listing category. You can use the same <code>wpseo_breadcrumb_links<\/code> filter to trim the listing title to a few words on listing pages only. Add the snippet with the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a> or your child theme&#8217;s functions.php.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;wpseo_breadcrumb_links&#039;, &#039;my_gd_short_breadcrumb&#039;, 20 );\nfunction my_gd_short_breadcrumb( $crumbs ) {\n\tif ( ! function_exists( &#039;geodir_is_page&#039; ) || ! geodir_is_page( &#039;detail&#039; ) || empty( $crumbs ) ) {\n\t\treturn $crumbs;\n\t}\n\n\t$keys = array_keys( $crumbs );\n\t$last = end( $keys );\n\n\tif ( ! empty( $crumbs&#091; $last &#093;&#091;&#039;text&#039;&#093; ) ) {\n\t\t$crumbs&#091; $last &#093;&#091;&#039;text&#039;&#093; = wp_trim_words( $crumbs&#091; $last &#093;&#091;&#039;text&#039;&#093;, 4, &#039;...&#039; );\n\t}\n\n\treturn $crumbs;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change <code>4<\/code> to the number of words you want to keep.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Shorten the breadcrumb text with Rank Math<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Rank Math stores the text of each item in the first position of the item array, so the snippet looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;rank_math\/frontend\/breadcrumb\/items&#039;, &#039;my_gd_short_rank_math_breadcrumb&#039;, 30 );\nfunction my_gd_short_rank_math_breadcrumb( $crumbs ) {\n\tif ( ! function_exists( &#039;geodir_is_page&#039; ) || ! geodir_is_page( &#039;detail&#039; ) || empty( $crumbs ) ) {\n\t\treturn $crumbs;\n\t}\n\n\t$keys = array_keys( $crumbs );\n\t$last = end( $keys );\n\n\tif ( isset( $crumbs&#091; $last &#093;&#091;0&#093; ) ) {\n\t\t$crumbs&#091; $last &#093;&#091;0&#093; = wp_trim_words( $crumbs&#091; $last &#093;&#091;0&#093;, 4, &#039;...&#039; );\n\t}\n\n\treturn $crumbs;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the breadcrumb comes from your theme, check the theme&#8217;s documentation for a breadcrumb filter. The same idea works there: check <code>geodir_is_page( &#039;detail&#039; )<\/code> and trim the last item.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GeoDirectory does not print a breadcrumb of its own. The breadcrumb you see on a listing page comes from your theme or from an SEO plugin such as Yoast SEO or Rank Math, and the last item is the listing title. A long title makes a long breadcrumb, so there are two ways to shorten [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,432],"class_list":["post-2269","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-how-tos"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2269"}],"version-history":[{"count":2,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2269\/revisions"}],"predecessor-version":[{"id":2717,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2269\/revisions\/2717"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2269"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2269"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}