0

ワードプレスでnext_posts_link();http://currenturl.com/currentpage**/page/x/**. functions.php に何を追加してhttp://baseurl.com/page/x/、すべての場合に返すことができるので、現在のページに /page/x/ を追加するだけで絶対 URL を返すことができます。

あなたのアイデアをありがとう!

4

2 に答える 2

0
$url = 'http://' . $_SERVER['SERVER_NAME'] . next_posts_link();

出力: http://baseurl.com/page/x/

于 2012-09-20T22:49:14.933 に答える
0

正規表現はあなたの友達です:

$test = 'http://example.com/test';
$test = preg_replace('/^http:\/\/.*?(\/.*)/', "http://baseurl.com$1", $test);
echo $test;

ニーズに合わせて調整します。ベース URL を定数として定義し、この機能を関数にカプセル化することは価値があるかもしれません。

于 2012-09-20T23:20:48.400 に答える