We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The text was updated successfully, but these errors were encountered:
function get_post_images($_post = null) { global $post; global $ram; global $pr_img; if (empty($ram) || $pr_img==55) { $ram = range (1,55); shuffle ($ram); $pr_img=0; } if ($_post != null) { $post = $_post; } $post_id = $post->ID; // 如果有封面图取封面图 if (has_post_thumbnail()) { $res = get_the_post_thumbnail_url($post, 'large'); if ($res != null) { return $res; } } if ($post_id == null && $post) { $content = $post->post_content; } else { $content = get_post($post_id)->post_content; } preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches); if ($matches && $matches[1]) { $res = $matches[1][0]; } else { $new_post=$ram[$pr_img]; $pr_img=$pr_img+1; $res = get_stylesheet_directory_uri() . '/assets/img/random/' . $new_post . '.jpg'; } return $res; }
这是我自己修改的随机图不重复的方法
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: