replace link (8 posts)

  1. blueyez
    Posted 7 years ago #

    i have the next function

    $hide = array('<a href="http://web.imobtour.ro/rent-a-car/" title="Rent-A-Car">Rent-A-Car</a>');
    $replace_with = '<a href="http://rac.imobtour.ro" title="Rent-A-Car" target="_blank">Rent-A-Car</a>';
    function censor($context) {
        global $hide, $replace_with;
     foreach ($hide as $words) {
     $context = eregi_replace($words, $replace_with, $context);
    return $context;

    i want to replace a link from the navigation - pages

    and i use
    <?php censor(wp_list_pages('depth=1&title_li=' )); ?>

    so i don't create a manually button.

    is there a script in wordpress codex that cand do this ? so i don't have edit the theme code?

    what is bad in my "script" ( is not made by me :P )

    i get this:
    Warning: Invalid argument supplied for foreach() in /home/btour/public_html/web/wp-content/themes/default/header.php on line 36

  2. moshu
    Posted 7 years ago #

    I am not sure what you want...
    So, forget the technical things and just describe in plain English (or Romanian) WHAT is the end result you want. We will tell you the HOW.

  3. blueyez
    Posted 7 years ago #

    i have:


    page1 = http://localhost/home
    page2 = http://localhost/about
    page3 = http://localhost/what

    i want page2 to transform into a pop up link

    insteat of <a href="http://localhost/about" title="about">about</a>

    to be:
    <a href="popUp('http://localhost/about')" title="About">About</a>

    get it ?

  4. moshu
    Posted 7 years ago #

    No, I don't.

    Do you want a simple popup link or do you want to redirect that Page to something else, for example to another URL?
    And there was nothing "popup" in the code you provided?

    Măi, codul din primul post arată că vrei să mergi la un alt URL.
    Vezi, dacă asta te ajută:

  5. Michael Torbert
    WordPress Virtuoso
    Posted 7 years ago #

    Display the pages manually instead of using wp_list_pages.

  6. blueyez
    Posted 7 years ago #

    i can't do that. is not me the owner of the site, and i don't wanna come back when he needs a new page !

  7. moshu
    Posted 7 years ago #

    You didn't answer my question(s)...

  8. Michael Torbert
    WordPress Virtuoso
    Posted 7 years ago #

    Well an easy solution to that would be put them in manually, and then use wp_list_pages(take out the ones currently there) so then when he adds new ones they'll show up.
    Or alternatively, tell him the html code to copy/paste so that he can add them manually.

Topic Closed

This topic has been closed to new replies.

About this Topic