Berkem Ceylan » Blog Arşivi » Wordpress Çözümleri #01 (güncellendi)


Wordpress Çözümleri #01 (güncellendi)

Wordpress altyapısını ne zaman güncellesem, ana sayfanın en altında bulunan  “Önceki Yazılarım” linki, çift index sayfasına yönleniyordu. Bunu tek satır basit bir kod ile çözmek mümkün.

WP-Includes altında formatting.php dosyasını açıp aşağıdaki kodu eklemeniz sorunu çözmenize yetecektir.

1
$url = str_replace('index.php/Index.php','index.php',$url);

fonksiyonunuz tam olarak şu şekilde gözükmelidir.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function clean_url( $url, $protocols = null, $context = 'display' ) {
    $original_url = $url;

    if ('' == $url) return $url;
    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    $strip = array('%0d', '%0a', '%0D', '%0A');
    $url = _deep_replace($strip, $url);
    $url = str_replace(';//', '://', $url);
    /* If the URL doesn't appear to contain a scheme, we
     * presume it needs http:// appended (unless a relative
     * link starting with / or a php file).
     */

    if ( strpos($url, ':') === false &&
        substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
        $url = 'http://' . $url;

    // Replace ampersands and single quotes only when displaying.
    if ( 'display' == $context ) {
        $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
        $url = str_replace( "'", ''', $url );
        $url = str_replace('index.php/Index.php','index.php',$url); //eklenen kısım burası//
    }

Kaynak: http://www.poiesis.co.za/index.php/2009/06/double-indexphp-problem/

Etiketler:



2 yorum şu şekilde;

  1. Berker Peksağ demiş ki:

    Bu statik bi’ çözüm hacı.

    http://www.berkemceylan.com/index.php/page/2/

    Burada patlıyor misal.

  2. Berkem Ceylan demiş ki:

    Webte çözümü bulup, düzelttim. Teşekkürler.

Ben de yorum yapayım?