通信更新 wordpress 图片相对路径修改 , pan.com 700,架设lighttpd, wordpress文件修改的位置在 引用里面

wordpress, 图片相对路径

function wp_get_attachment_url( $post_id =0 ) {
$file_dir=dirname(__FILE__);
$server_root=$_SERVER[DOCUMENT_ROOT];
$file_dir=substr($file_dir,strlen($server_root));
$file_dir=substr($file_dir,0,-12);
if($file_dir!=''){
$file_dir='/'.substr($file_dir,1);
}

$post_id = (int) $post_id;
if ( !$post =& get_post( $post_id ) )
return false;

$url = '';
if ( $file = get_post_meta( $post->ID,'_wp_attached_file', true) ) { //Get attached file
if ( ($uploads = wp_upload_dir())&& false === $uploads['error'] ) { //Get upload directory
if ( 0 === strpos($file,$uploads['basedir']) ) //Check that the upload base exists in the file location
//$url = str_replace($uploads['basedir'],$uploads['baseurl'], $file); //replace file location with url location
$url=$file_dir."/wp-content/uploads/".$file;
elseif ( false !== strpos($file, 'wp-content/uploads'))
//$url = $uploads['baseurl'] . substr($file, strpos($file, 'wp-content/uploads') + 18 );
$url=$file_dir."/wp-content/uploads/".$file;
else
//$url = $uploads['baseurl'] ."/$file"; //Its a newly uploaded file, therefor $file is relative tothe basedir.
$url=$file_dir."/wp-content/uploads/".$file;
}
}
if ( empty($url) ) //If any of the aboveoptions failed, Fallback on the GUID as used pre-2.7, not recomended to relyupon this.
$url = get_the_guid( $post->ID );
if ( 'attachment' != $post->post_type|| empty($url) )
return false;
return apply_filters('wp_get_attachment_url', $url, $post->ID );
}

 

3 cd lighttpd/
5 vim lighttpd.conf
38 bzip2 \
39 lighttpd-mod-fastcgi \
40 lighttpd-mod-access \
41 cd /web/press
46 cd themes/
53 vim functions.php
54 nano functions.php
55 vim functions.php
56 cd /opt/share/htdocs/press/wp-admin

58 cp options.php options.php-bak
59 vim options.php
63 cd wp-includes/
65 cp option.php option.php.bak
66 vim option.php
67 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/function.php
68 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
69 vim /opt/share/htdocs/press/wp-config.php
70 vim option.php
71 ll
72 vim option.php~
73 ll
74 vim option.php
75 ll
76 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
77 ll
78 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
79 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.p*
80 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php.*
81 ll
82 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
83 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
84 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php.*
85 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
86 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php~
87 cp /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php~ /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php--x相对路径
88 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php×
89 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
90 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php*
91 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php--x*
92 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
93 ll
94 vim wp-includes/post.php
95 cd ..
96 vim wp-includes/post.php
97 cp wp-includes/post.php wp-includes/post.php-修改相对路径-前-文件
98 ll wp-includes/post.ph*
99 vim wp-includes/post.php
100 history
101 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
102 ll /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php*
103 vim /opt/share/htdocs/press/wp-content/themes/twentyseventeen/functions.php
104 vim wp-includes/post.php
105 ll wp-includes/post.php
106 ll wp-includes/post.php*
107 mv wp-includes/post.php wp-includes/post.php-modied
108 mv wp-includes/post.php~ wp-includes/post.php
109 ll
110 history

 

架设  lighttpd! for  NewFifi

  0 ll
1 cd /opt
2 cd bin
3 ll
4 ls
5 ng
6 ng update
7 ping pkg.entware.net
8 ng update
9 ng install lighttpd
10 cd /opt/etc
11 cd lighttpd/
12 ll
13 vim lighttpd.conf
14 ll /opt/share/htdocs/
15 cd ..
16 cd init.d/
17 l
18 ll
19 ./S80lighttpd
20 ./S80lighttpd start
21 ./S80lighttpd check
22 netstat -apn | grep 700
23 netstat -apn
24 ll
25 vim S80lighttpd
26 lighttpd -f /opt/etc/lighttpd/lighttpd.conf
27 vim /opt/etc/lighttpd/lighttpd.conf
28 touch "/opt/var/log/lighttpd/error.log"
29 chown -R nobody,nogroup "/opt/var/log/lighttpd/error.log"
30 chown -R nobody.nogroup "/opt/var/log/lighttpd/error.log"
31 ll "/opt/var/log/lighttpd/error.log"
32 touch "/opt/var/log/lighttpd/error.log"
33 ll "/opt/var/log/lighttpd/error.log"
34 lighttpd -f /opt/etc/lighttpd/lighttpd.conf
35 ./S80lighttpd c
36 ./S80lighttpd stop
37 ./S80lighttpd start
38 ll
39 vim "/opt/var/log/lighttpd/error.log"
40 ll
41 netstat -apn
42 netstat -apn | grep php
43 ll
44 vim /opt/etc/lighttpd/lighttpd.conf
45 ./S80lighttpd stop
46 ./S80lighttpd start
47 cd /opt/lib/php
48 ll
49 ng install \
50 bzip2 \
51 lighttpd-mod-fastcgi \
52 lighttpd-mod-access \
53 ./S80lighttpd stop
54 ./S80lighttpd start
55 /opt/etc/init.d/S80lighttpd
56 /opt/etc/init.d/S80lighttpd start
57 /opt/etc/init.d/S80lighttpd stop
58 /opt/etc/init.d/S80lighttpd start
59 history