Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Page & Category Menu Bars (http://forum.bytesforall.com/forumdisplay.php?f=10)
-   -   [SOLVED] How do I make one custom link in the Pages Menu? (http://forum.bytesforall.com/showthread.php?t=3513)

iPuppet Sep 18, 2009 09:27 AM

[SOLVED] How do I make one custom link in the Pages Menu?
 
I don't see this posted anywhere, and don't know if it is possible, but I would like to link one tab in the pages menu to an outside url, e.g., my ticket vendor. I have other links available, but a link on the ticket tab would be quite elegant. For now, the tab goes to a dummy page on my website. The alternative is to eliminate the page altogether and rely on other buttons, which are working now thanks to juggledad catching my error.

Flynn Sep 18, 2009 02:58 PM

Add this to the bottom of Atahualpa's functions.php

PHP Code:

<?php function replace_menu_link($string) {
return 
str_replace('http://www.yoursite.com/link/to/dummypage/',
    
'http://www.othersite.com/link.html'$string);
}
add_filter('wp_list_pages''replace_menu_link');
?>

To replace several links use this instead

PHP Code:

<?php function replace_menu_link($string) {
$old_urls = array('http://www.yoursite.com/tobe/replaced/'
    
'http://www.yoursite.com/tobe/replaced2/'
    
'http://www.yoursite.com/tobe/replaced3/');
$new_urls = array('http://www.othersite.com/link1.html'
    
'http://www.othersite.com/link2/'
    
'http://www.othersite.com/3rdlink/');
$string str_replace($old_urls$new_urls$string);
return 
$string;
}
add_filter('wp_list_pages''replace_menu_link');
?>


andreigoea Sep 19, 2009 08:18 AM

Hello,

I've modified links in the menu using both this method as well as the redirector plug-in.

The issue with both is, however, that when clicked on, while viewing the linked page, the menu item does not change status to :active so all stiling is lost.

The item is still "page_item page-item-6" as opposed to:"page_item page-item-9 current_page_item"

Is there any way around this?

Thank you.

iPuppet Sep 19, 2009 10:38 PM

Flynn, this did exactly what I needed. Thank you so much for the great template and the support. What versatility! You are to be congratulated on a superb piece of work.

Flynn Sep 21, 2009 07:11 AM

Quote:

Originally Posted by andreigoea (Post 14946)
Hello,

I've modified links in the menu using both this method as well as the redirector plug-in.

The issue with both is, however, that when clicked on, while viewing the linked page, the menu item does not change status to :active so all stiling is lost.

The item is still "page_item page-item-6" as opposed to:"page_item page-item-9 current_page_item"

Is there any way around this?

Thank you.

You could try adding to js.php after

PHP Code:

jQuery(document).ready(function(){ 

this:

PHP Code:

jQuery('ul#rmenu2 li a').click(function() {
    
jQuery('ul#rmenu2 li').removeClass('current_page_item');
    
jQuery(this).parent().addClass('current_page_item');



sunnivie Sep 23, 2009 12:03 PM

Flynn,

The piece of code you mentioned first did EXACTLY the right thing for my site as well. Thank you so much for posting it!

One final nit-picky question: is it possible to make the (Atahualpa) blog home page (or the primary page) tab be the SECOND tab listed? I've been able to re-order the other pages in the correct hierarchy through the Pages function, but I don't see how to rearrange the order of the primary blog page.

I'm redesigning the blog for my publication, and the page tabs each link to pages back on the existing homepage in the menu bar, which is already in a set order at www.outfrontcolorado.com. (That menu bar is the order I need to mimic.)

Essentially, what I need to do is switch the first and second page tabs on my menu bar at www.outfrontcolorado.com/blog

I'm running WP 2.8.3 with Atahualpa 3.4.2.

My guess is this is a simple fix, I'm just missing something. Thank you for your help and this fantastic theme and forum.

juggledad Sep 24, 2009 03:43 AM

If you have a static landing page, then this is easy.
1) define a 'page' for the blog - name it what ever
2) at dashboard->settings->reading set your landing page and blog page
3) at ATO->Page Menu Bar->Home link in Page Menu Bar - blank out this entry
4) set ATO->Page Menu Bar->Sorting order of Page Menu Bar to 'menu-order'
4) give each page an 'order' to match how you want it in the menu (dashboard->page->edit->'yourpage'->order

and you should be all set

sunnivie Sep 24, 2009 12:22 PM

Juggledad, I just don't have enough praise to give you. (I do, however, have another donation on its way. :))

http://www.outfrontcolorado.com/blog/

That did it - they're in the right order and all link to the correct pages. Thank you again!


All times are GMT -6. The time now is 07:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.