{"id":1949,"date":"2017-08-21T04:35:25","date_gmt":"2017-08-21T04:35:25","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=1949"},"modified":"2023-07-24T10:12:52","modified_gmt":"2023-07-24T10:12:52","password":"","slug":"glossary-layout-lists-second-word-last-name-surname","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/glossary-layout-lists-second-word-last-name-surname\/","title":{"rendered":"Glossary layout &#8211; create indexes from second word (last name, surname)"},"content":{"rendered":"<p>Content Views Pro helps you to show posts in glossary layout easily (<a href=\"https:\/\/contentviewspro.com\/demo\/block\/glossary\/\" target=\"_blank\" rel=\"noopener noreferrer\">see demo<\/a>).<br \/>\nIf your post&#8217;s title is person name, you might want to list people by their surname (last name). To do that, please add this code to file <strong>functions.php<\/strong> in the theme&#8217;s folder (or install this plugin <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" rel=\"nofollow\">Code Snippets<\/a> then add this code to <a href=\"https:\/\/ps.w.org\/code-snippets\/assets\/screenshot-2.png\" rel=\"nofollow\">the &#8220;Code&#8221; textarea<\/a>):<\/p>\n<pre style=\"font-size: 13px;\">\/\/ Content Views Pro - Glossary index by last name (surname)\nadd_filter( 'pt_cv_glossary_key', 'cvp_theme_glossary_key_change', 100, 2 );\nfunction cvp_theme_glossary_key_change( $args, $title ) {\n\tglobal $pt_cv_id;\n\tif ( $pt_cv_id === 'VIEW_ID' ) {\n\t\t$next_word\t = mb_substr( $title, (int) strpos( $title, ' ' ) + 1 );\n\t\t$args\t\t = mb_substr( $next_word, 0, 1 );\n\t}\n\n\treturn $args;\n}\n<\/pre>\n<p>(replace <strong>VIEW_ID<\/strong> with <a href=\"https:\/\/contentviewspro.com\/documentation\/article\/what-is-id-of-a-view\/\">ID of your View<\/a>)<\/p>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Content Views Pro helps you to show posts in glossary layout easily (see demo). If your post&#8217;s title is person name, you might want to list people by their surname (last name). To do that, please add this code to file functions.php in the theme&#8217;s folder (or install this plugin Code Snippets then add this &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/glossary-layout-lists-second-word-last-name-surname\/\"> <span class=\"screen-reader-text\">Glossary layout &#8211; create indexes from second word (last name, surname)<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[25],"doc_tag":[21],"class_list":["post-1949","docs","type-docs","status-publish","hentry","doc_category-adjustment","doc_tag-custom-code"],"year_month":"2026-09","word_count":127,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"CVP","author_nicename":"cvp","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/cvp\/"},"doc_category_info":[{"term_name":"Adjustment","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/adjustment\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=1949"}],"version-history":[{"count":1,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1949\/revisions"}],"predecessor-version":[{"id":4866,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1949\/revisions\/4866"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=1949"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=1949"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=1949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}