how can i use the plus sign instead of dashes ?

Discussion in 'WordPress' started by Hamzar, Oct 6, 2010.

  1. #1
    hey
    like i said in the question i want use the plus sign(+) instead of dashes so the posts will be like that: some+post+test .
    i did something a filter to do that so in the front page it looks like good but when i try to open the post i see the 404 error and in admin panel the filter don't works(in the editable slug field!) so this is the filter:
    <?php
    
    function sanitize_permalink_with_undescores($title) {
        $title = strip_tags($title);
        // Preserve escaped octets.
        $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
        // Remove percent signs that are not part of an octet.
        $title = str_replace('%', '', $title);
        // Restore octets.
        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
    
        $title = remove_accents($title);
        if (seems_utf8($title)) {
            if (function_exists('mb_strtolower')) {
                $title = mb_strtolower($title, 'UTF-8');
            }
            $title = utf8_uri_encode($title);
        }
    
        $title = strtolower($title);
        $title = preg_replace('/&.+?;/', '', $title); // kill entities
        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
        $title = preg_replace('/\s+/', '+', $title);
        $title = preg_replace('|_+|', '+', $title);
        $title = trim($title, '+');
    
        return $title;
    }
    
    remove_action('sanitize_title', 'sanitize_title_with_dashes');
    add_action('sanitize_title', 'sanitize_permalink_with_undescores');
    ?>
    PHP:

    another question , when i use non-latin characters the wordpress break the permalink and preserve just 30 letters(NB: characters works fine just they're broken) !! how can i solve that and make the slug accept unlimited letters of non latin characters?
    and thanks .
     
    Hamzar, Oct 6, 2010 IP
  2. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Why would you want to do this? You do understand that SE's read URL structure the same and if you change the structure to something that is not supported you are going to ruin your blog, right?
    Can you show me an example of a website that uses "+" in it's URL structure instead of "-"?
     
    hmansfield, Oct 6, 2010 IP
  3. browntwn

    browntwn Illustrious Member

    Messages:
    8,347
    Likes Received:
    848
    Best Answers:
    7
    Trophy Points:
    435
    #3
    search this in G. Many sites use + sign their URLs and rank quite well.

    "http://search.allheart.com/?query="

    ex: http://search.allheart.com/?query=howie+lab+coat&c=y1
     
    browntwn, Oct 6, 2010 IP
  4. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    take , this one of many times that's use plus sign :
    http://www.araby-news.com/news/هدية+من+عالم+التقنية%3A+برنامج+BitDefender+Internet+Security+2010
    Code (markup):
    as a webdeveloper i will not accepte that ! but a client asked me that , i tried to convice him that dashes is more fit but i didn't got a result!
     
    Hamzar, Oct 6, 2010 IP
  5. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Oh, yeah, I guess you are right. Now that I think about it, it's common in a lot of affiliate links as well.
    But I still don't understand why it's so important to make such a monumental change in the way your blog functions.

    It's not going to give you any SEO boost or anything like that, so what's wrong with the way WP functions naturally?
     
    hmansfield, Oct 6, 2010 IP
  6. browntwn

    browntwn Illustrious Member

    Messages:
    8,347
    Likes Received:
    848
    Best Answers:
    7
    Trophy Points:
    435
    #6
    That I have no idea. I really have only seen it as part of a search query url string.
     
    browntwn, Oct 6, 2010 IP
  7. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    like i said in the thread one of my clients wants that so please any help?
     
    Hamzar, Oct 6, 2010 IP
  8. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #8
    Sorry, I can't help and I wouldn't even begin to let my clients do something like that. It has no bearing on anything SEO and what ever benefit they think it is going to provide for them is likely based on wrong or incomplete information.

    I know it's not what you asked, but I've been working with Wordpress for years and I don't see any practical reason to do something like this. To me it's a frivolous as changing all of your pages to .html
    A simple URL structure is the best way to go. Complicating things is only going to hurt them, not help...but then again, these days everyone thinks they have the new hot trick.
     
    hmansfield, Oct 7, 2010 IP
  9. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thank you i'll try ..
    so what about the second problem do you have anyidea?
     
    Hamzar, Oct 7, 2010 IP
  10. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #10
    Funny, you seem determined to do things to your URL structure that are going to harm you. Usually characters aren't allowed because they are not supported by browsers.
    What characters are you trying to use?
    Do you just need a language pack?
    What language is the blog in and what language do you have it set up for?
     
    hmansfield, Oct 7, 2010 IP
  11. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    the language is arabic and wordpress accept it 100%
    ex : i entered the following title : لا إله إلا الله محمد رسول الله
    good , but the slug always broke the title (لا-إله-إلا) just that !!
    so i want let him use ugly title like in english words ..
     
    Hamzar, Oct 7, 2010 IP
  12. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    more details at
    http://en.support.wordpress.com/posts/post-title-url/
    Code (markup):
    so i want keep lonk post titles evenif i use a non-western character like arabic , so please anyone can help me?
     
    Hamzar, Oct 7, 2010 IP
  13. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #13
    Ah ha! Now it's starting to make sense. Sorry I don't have a solution for that.
    Are you using Wordpress in English and trying to place Arabic in it or are you using Wordpress in Arabic?
    http://www.ar-wp.com/
     
    hmansfield, Oct 7, 2010 IP
  14. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    i use wordpress arabic ..
     
    Hamzar, Oct 7, 2010 IP
  15. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #15
    You may have to try those forums to get an accurate answer. I know nothing about Arabic, Wordpress in Arabic or any of the symbols.
    In the future you may want to post that you are having problems with Worpdress Arabic...your problem is not simply about pluses and dashes as you titled it...it has more to do with the language and URL structure.
     
    hmansfield, Oct 7, 2010 IP
  16. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    arabic is only an example as you can read the problem is with all non-western character
     
    Hamzar, Oct 7, 2010 IP
  17. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #17
    Then you have to use a non western translation, It seems that the problem is apparent...you are attempting to mix 2 different character sets.
     
    hmansfield, Oct 7, 2010 IP
  18. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    i want just to know the function wich manage this operation and i'll take care of it !
    when i add the title from the admin i don't know what's the process because all done by ajax so i can't follow the process
    so i wish really that someone can help me ..
     
    Hamzar, Oct 7, 2010 IP
  19. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #19
    Sorry, again, I really don't know.
     
    hmansfield, Oct 7, 2010 IP
  20. Hamzar

    Hamzar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    thank you already for your replies dear
     
    Hamzar, Oct 8, 2010 IP