【问题标题】:How to remove read more on wordpress?如何删除在 wordpress 上阅读更多内容?
【发布时间】:2013-11-30 10:56:33
【问题描述】:

如何删除我网站 (wordpress) 上的阅读更多按钮?

the_content( __( 'Read more →', 'ward' ) );

【问题讨论】:

    标签: wordpress web


    【解决方案1】:

    最好使用过滤器 - 这样您就不需要更改所有主题的文件并搜索特定代码..

    add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );
    
    function my_more_link( $more_link, $more_link_text ) {
    $my_custom_more = "Continue reading this post"; // leave NULL to diable
        return str_replace( $more_link_text, $my_custom_more, $more_link );
    }
    

    并以几乎相同的方式使用add_filter('excerpt_more', 'my_more_link');作为摘录

    【讨论】:

      【解决方案2】:

      尝试替换

      the_content( __( 'Read more →', 'ward' ) );

      与:

      the_excerpt();

      或者你可以在元素上使用 CSS display:none; 来隐藏它。

      【讨论】:

        【解决方案3】:

        更好的过滤器。

        add_filter( 'the_content_more_link', 'disable_more_link', 10, 2 );
        
        function disable_more_link( $more_link, $more_link_text ) {
            return;
        }
        

        这可能会禁用所有..尚未测试..

        【讨论】:

          【解决方案4】:

          来自法典 (http://codex.wordpress.org/Customizing_the_Read_More):

          <?php the_content( $more_link_text , $strip_teaser ); ?>

          $more_link_text 将链接文本设置为“阅读更多”。第二个,$strip_teaser,设置“更多”链接是隐藏(TRUE)还是显示(FALSE)。默认为 FALSE,显示链接文本。

          要删除预告片:

          改变 the_content();在你的 index.php 中(即第二个参数控制这个):

          the_content('',FALSE,'');

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2021-08-22
            • 2019-07-17
            • 1970-01-01
            相关资源
            最近更新 更多