Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取最新文章 小工具 BUG #46

Closed
krvipsoft opened this issue Jan 13, 2021 · 1 comment
Closed

获取最新文章 小工具 BUG #46

krvipsoft opened this issue Jan 13, 2021 · 1 comment
Labels
BUG Something isn't working 已解决

Comments

@krvipsoft
Copy link

/~https://github.com/Licoy/wordpress-theme-puock/blob/master/inc/fun/widget.php

 $sql = "SELECT ID , post_title FROM $wpdb->posts WHERE post_type = 'post'
                AND post_status = 'publish' AND TO_DAYS(now()) - TO_DAYS(post_date) < {$days}
                ORDER BY ID DESC LIMIT 0 , {$nums} ";
        $posts = $wpdb->get_results($sql);
        $out = "";
        foreach ($posts as $post){
            $out .= '<div class="media-link mt20">
                    <h2 class="t-lg t-line-1" title="'.get_the_title($post).'">
                        <i class="czs-angle-right-l t-sm c-sub mr-1"></i>
                        <a class="a-link t-w-400 t-md" title="'.get_the_title($post).'"
                         href="'.get_permalink($post).'">'.get_the_title($post).'</a>
                    </h2>
                </div>';
        }

get_permalink($post) 获取不到连接

应该修改为 SELECT * FROM

@krvipsoft krvipsoft added the BUG Something isn't working label Jan 13, 2021
@Licoy
Copy link
Owner

Licoy commented Jan 13, 2021

@krvipsoft 我这边实际测试是可以获取的没有问题,麻烦告知一下您的环境信息或固定链接格式,可能是固定链接格式不一致导致的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working 已解决
Projects
None yet
Development

No branches or pull requests

2 participants