Displaying all images from a WordPress post

前端 未结 5 1542
一整个雨季
一整个雨季 2020-12-09 23:36

I have this piece of code I found on some blog, that\'s supposed to display all images from a WordPress post.

function getImage() {
    global $more;
    $m         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 00:12

    Try this ! It may work.

    function getImage() {
        global $more;
        $more = 1;
        $link = get_permalink();
        $content = get_the_content();
        $count = substr_count($content, '');
            $postOutput = substr($post, 0, $imgEnd+1);
            $postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
            if(stristr($postOutput,'

提交回复
热议问题