Jor*_*win 2 php wordpress elementor
我正在使用 Elementor Pro 构建我的页面模板,并且我已使用 \xe2\x80\x93 下面的函数将标签标签更改为“主题”,这在除 Elementor Archive Title 小部件(由通过常规标题小部件,并将动态标签设置为“存档标题”)。
\n以下是我将标签更改为主题的功能:
\n // Change tags to topics\n\nfunction wd_hierarchical_tags_register() {\n\n // Maintain the built-in rewrite functionality of WordPress tags\n\n global $wp_rewrite;\n\n $rewrite = array(\n \'hierarchical\' => false, // Maintains tag permalink structure\n \'slug\' => get_option(\'tag_base\') ? get_option(\'tag_base\') : \'tag\',\n \'with_front\' => ! get_option(\'tag_base\') || $wp_rewrite->using_index_permalinks(),\n \'ep_mask\' => EP_TAGS,\n );\n\n// Redefine tag labels (or leave them the same)\n \n $labels = array(\n \'name\' => _x( \'Topics\', \'Taxonomy General Name\', \'hierarchical_tags\' ),\n \'singular_name\' => _x( \'Topic\', \'Taxonomy Singular Name\', \'hierarchical_tags\' ),\n \'menu_name\' => __( \'Topics\', \'hierarchical_tags\' ),\n \'all_items\' => __( \'All Topics\', \'hierarchical_tags\' ),\n \'parent_item\' => __( \'Parent Topic\', \'hierarchical_tags\' ),\n \'parent_item_colon\' => __( \'Parent Topic:\', \'hierarchical_tags\' ),\n \'new_item_name\' => __( \'New Topic Name\', \'hierarchical_tags\' ),\n \'add_new_item\' => __( \'Add New Topic\', \'hierarchical_tags\' ),\n \'edit_item\' => __( \'Edit Topic\', \'hierarchical_tags\' ),\n \'update_item\' => __( \'Update Topic\', \'hierarchical_tags\' ),\n \'view_item\' => __( \'View Topic\', \'hierarchical_tags\' ),\n \'separate_items_with_commas\' => __( \'Separate topics with commas\', \'hierarchical_tags\' ),\n \'add_or_remove_items\' => __( \'Add or remove topics\', \'hierarchical_tags\' ),\n \'choose_from_most_used\' => __( \'Choose from the most used\', \'hierarchical_tags\' ),\n \'popular_items\' => __( \'Popular Topics\', \'hierarchical_tags\' ),\n \'search_items\' => __( \'Search Topics\', \'hierarchical_tags\' ),\n \'not_found\' => __( \'Not Found\', \'hierarchical_tags\' ),\n );\n \n // Override structure of built-in WordPress tags\n \n register_taxonomy( \'post_tag\', \'post\', array(\n \'hierarchical\' => true, // Was false, now set to true\n \'query_var\' => \'tag\',\n \'labels\' => $labels,\n \'rewrite\' => $rewrite,\n \'public\' => true,\n \'show_ui\' => true,\n \'show_admin_column\' => true,\n \'_builtin\' => true,\n ) );\n \n }\n add_action(\'init\', \'wd_hierarchical_tags_register\');\n \nRun Code Online (Sandbox Code Playgroud)\n尽管有上述代码,我仍然在存档页面上看到“标签”作为前缀。我还尝试从存档标题中删除前缀,但这对 Elementor 标题小部件也没有影响。
\n // Remove default labels from archive title\n\n add_filter( \'get_the_archive_title\', function ($title) {\n if ( is_category() ) {\n $title = single_cat_title( \'\', false );\n } elseif ( is_tag() ) {\n $title = single_topic_title( \'\', false );\n } elseif ( is_author() ) {\n $title = \'<span class="vcard">\' . get_the_author() . \'</span>\' ;\n } \n return $title;\n});\nRun Code Online (Sandbox Code Playgroud)\n任何帮助,将不胜感激。如果我可以将标签更改为存档标题上的主题,或者完全删除存档标题中的“标签:”前缀(我也可以删除作者/类别/月/年),我会很高兴。
\n