WordPress.org

Support

Support » Themes and Templates » replace link

replace link

  • i have the next function

    <?php
    $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 😛 )

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    i have:

    page1/page2/page3

    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 ?

    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ă:
    http://wordpress.org/extend/plugins/easyredirect/

    Michael Torbert
    WordPress Virtuoso

    @hallsofmontezuma

    Display the pages manually instead of using wp_list_pages.

    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 !

    You didn’t answer my question(s)…

    Michael Torbert
    WordPress Virtuoso

    @hallsofmontezuma

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘replace link’ is closed to new replies.