Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 可湿性粉剂去除贴子末尾的圆点_Php_Wordpress - Fatal编程技术网

Php 可湿性粉剂去除贴子末尾的圆点

Php 可湿性粉剂去除贴子末尾的圆点,php,wordpress,Php,Wordpress,我使用WP主题,动态加载文章,在每个博客文章的末尾添加3个点。我需要去掉这3个点 我试过: 在index.php中: 1.1在模板中手动注释点。这仅在前10篇文章中删除了点,在另外90篇文章中删除了点 1.2我尝试使用.slice(0,-3)来切掉这些点。这对我不起作用。它在没有(窗口)的情况下运行了10次。滚动,但当我添加它时,它根本不起作用 jQuery(window).scroll(function() { jQuery('.hideifneed').each(function

我使用WP主题,动态加载文章,在每个博客文章的末尾添加3个点。我需要去掉这3个点

我试过:

  • index.php
    中:

    1.1在模板中手动注释点。这仅在前10篇文章中删除了点,在另外90篇文章中删除了点

    1.2我尝试使用
    .slice(0,-3)
    来切掉这些点。这对我不起作用。它在没有
    (窗口)的情况下运行了10次。滚动
    ,但当我添加它时,它根本不起作用

      jQuery(window).scroll(function() {
        jQuery('.hideifneed').each(function(){
            var text = jQuery(this).text();
            var removeDots = text.slice(0, -3)
            console.log(removeDots);
        });
    
    });
    
  • functions.php
    的末尾输入代码片段。下面的代码对我都没有帮助

  • 我试过这个(2.1):

    而这(2.2):

    这(2.3):

    这(2.4):

    我还能试什么?你有什么想法吗

    编辑: 在我的案例中,唯一有效的方法是在管理面板>发布>发布设置>摘录关闭中。这只会删除一篇文章中的点,因此对我来说这不是一个真正的选项,它的工作原理如下:

    function new_excerpt_more($more) {
        global $post;
        return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    对我来说,它的工作原理如下:

    function new_excerpt_more($more) {
        global $post;
        return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    

    您是否尝试使用与single.php相同的代码。注意:Single.php位于当前主题文件夹下,该文件夹为:site.tld/wp-content/themes/your-theme/Single。php@Yasir,谢谢你的提示,我试过了,但没有成功。试着在你的主题文件下找到这3个点。你试过使用与single.php相同的代码吗。注意:Single.php位于当前主题文件夹下,该文件夹为:site.tld/wp-content/themes/your-theme/Single。php@Yasir,谢谢你的提示,我试过了,但没用。试着在你的主题文件下找到这3个点。
    function custom_excerpt() {
     $text=preg_replace( "/\\[…\\]/",'place here whatever you want to replace',get_the_excerpt());
    echo '<p>'.$text.'</p>';
    }
    
    function wp_new_excerpt($text)
    {
        if ($text == '')
        {
            $allowed_ends = array('.', '!', '?');
            $text = get_the_content('');
            $text = strip_shortcodes( $text );
            $text = apply_filters('the_content', $text);
            $text = str_replace('...', ']]>', $text);
            $text = strip_tags($text);
            $text = nl2br($text);
            $excerpt_length = apply_filters('excerpt_length', 10000);
            $words = explode(' ', $text, $excerpt_length + 1);
            if (count($words) > $excerpt_length) {
                array_pop($words);
                array_push($words, '[]');
                $text = implode(' ', $words);
            }
        }
        return $text;
    }
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'wp_new_excerpt');
    
    function new_excerpt_more($more) {
        global $post;
        return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more');