Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

How do I make one custom link in the Pages Menu?


  #1  
Old Oct 27, 2009, 10:27 AM
kippiper
 
135 posts · Jun 2009
Hi guys!

I searched previous threads and found an answer to this question (with the same title) from Flynn. However, I am getting an error message.

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

<?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');
?>

Now, to be clear on what I did, I literally did what he said and added this as an additional <? ?> section after the last ?> of the original function.php code. My specific code is:

<?php function replace_menu_link($string) {
return str_replace('http://bestbiztips.com/quickmedquote/web-conference/',
'http://wc.iboomerang.com/skin-iboomerang/join.jsp?p=7711106', $string);
}
add_filter('wp_list_pages', 'replace_menu_link');
?>

Doing this, I get the following error:

Parse error: syntax error, unexpected T_STRING in /home/content/a/b/x/abxnetwork/html/quickmedquote/wp-content/themes/atahualpa/functions.php on line 1059

The website I am working on is for a client: http://www.bestbiztips.com/quickmedquote. I want the Web Conference page to go to an outside URL.

I am not conversant in PHP, so this is pretty Greek to me.

What am I missing?

Thanks so much!

KIP
  #2  
Old Oct 27, 2009, 11:45 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
What version of Atahualpa and WP?

check your code and make sure there are no invisible characters in it. When I copied the code from the other post, it shows several non-printable characteres which will cause errors when being parsed by php.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Oct 27, 2009 at 12:42 PM.
  #3  
Old Oct 27, 2009, 11:49 AM
kippiper
 
135 posts · Jun 2009
LOL! That would help!

The latest of both: WP 2.8.5 and Atahualpa 3.4.1

Thanks!
  #4  
Old Oct 27, 2009, 11:54 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Atahualpa is at 3.4.4 - see http://wordpress.bytesforall.com/?p=81
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Oct 27, 2009, 12:37 PM
kippiper
 
135 posts · Jun 2009
Hi Juggledad -

Okay, I upgraded and inserted the suggested code as I previously described.

Now I am getting this error:

Parse error: syntax error, unexpected T_STRING in /home/content/a/b/x/abxnetwork/html/quickmedquote/wp-content/themes/atahualpa344/functions.php on line 657

I have left the site with the error showing.

So I am still doing something wrong!

Thanks!
  #6  
Old Oct 27, 2009, 12:50 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
please send me a copy of your functions.php I can't reproduce this adding your code in. Must be something else.

If you can't figure out how to send a copy, you can create me an id (send it in a PM) so I can look at your backend (Dashboard->Apearances->Editor) to look at the code.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Oct 27, 2009, 06:28 PM
kippiper
 
135 posts · Jun 2009
Hi Juggledad -

Thanks bunches!!! Here is the functions.php file as a ZIP file.

I am switching back to the original version on the website so I can continue working on the site.

KIP
Attached Files
File Type: zip functions.zip (6.7 KB, 2375 views)
  #8  
Old Oct 27, 2009, 07:22 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
yup, non printable characters, a bunch of them!
delete the code and then type it in including all the spaces and try it again.

In case you are interested, I'm on a mac and there is a program called TextWrangler. One of it's features is you can 'view invisables' and it shows spaces, tabs, returns and any other non printable character.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #9  
Old Oct 28, 2009, 09:59 AM
kippiper
 
135 posts · Jun 2009
Okay, I know what caused this.

I created an html file for my notes on how to do this. I copied from the Design view of Dreamweaver instead of the Code view. So the Design view added all of the garbage.

YAY! It worked! Thanks so much!

Now, I realize there is one tweak not included in the original code. How would I code this PHP to open the link in a new window?

Thanks!

KIP

Last edited by kippiper; Oct 28, 2009 at 10:09 AM.
  #10  
Old Oct 28, 2009, 12:15 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you could try using
<?php function replace_menu_link($string) {
return str_replace('http://bestbiztips.com/quickmedquote/web-conference/',
'http://wc.iboomerang.com/skin-iboomerang/join.jsp?p=7711106 target="_blank"', $string);
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #11  
Old Oct 28, 2009, 04:11 PM
kippiper
 
135 posts · Jun 2009
Hi Juggledad -

Well, I thought about that and wasn't sure how to code it inside the PHP code.

So I tried your suggestions with double quotes, single quotes, and no quotes - and none worked.....

Any other thoughts?

Thanks!

KIP
  #12  
Old Oct 28, 2009, 07:58 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
hmmm, not off hand. that was a sot in the dark. I'd have to try this and take a look in the code to figure out what to do. Maybe when things calm down...and I get the yard raked...and the computer at church fixed and....
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #13  
Old Oct 28, 2009, 08:26 PM
kippiper
 
135 posts · Jun 2009
LOL! I hear that! Thanks so much for your time and all of the hand-holding...

KIP
  #14  
Old Oct 30, 2009, 09:22 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
If you put that code at the bottom of functions.php after the last closing ?> then use the code as is.

?>
<?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');
?>


If you put that code before the last closing ?> then don't use the opening <?php and closing ?> PHP tags of that code snippet:

<?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');
?>
?>
  #15  
Old Aug 7, 2010, 12:24 PM
kippiper
 
135 posts · Jun 2009
Hi Guys!

I have a new issue with this old situation.

There is a new site I am working on:

http://www.bestbiztips.com/biggamestudio

The homepage is straight HTML because the client wants this type of opening page and then link into the blog site.

When you enter the blog site, I want the HOME link to go back to the straight HTML home page. However, when I use the functions.php coding suggested here in this thread, the redirect is not working.

Any suggestions?

Thanks bunches in advance!

KIP
  #16  
Old Aug 7, 2010, 03:53 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Why don't you make a splash page and use it as the home page
There are directions in the gold forum tutorials
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #17  
Old Aug 7, 2010, 04:06 PM
kippiper
 
135 posts · Jun 2009
I can do that within the Atahualpa theme? Cool! I didn't realize that! I'll go check it out! Thanks!
  #18  
Old Aug 13, 2010, 12:14 PM
kippiper
 
135 posts · Jun 2009
Hi Juggledad -

Well, the concept for a splash page is good but not working with this particular site. I have 2 issues:

1. I am using an image map menu with the main graphic, and the image map does not work.
2. I am using Cincopa photo slide show, and it won't center.

You can see this at http://www.bestbiztips.com/biggamestudio/site/

So back to my original question: When you enter the blog site, I want the HOME link to go back to the straight HTML home page. However, when I use the functions.php coding suggested here in this thread, the redirect is not working.

Thanks!

KIP
  #19  
Old Aug 14, 2010, 06:54 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try this, code a home.php and just put your page's html in it...
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #20  
Old Sep 4, 2010, 12:31 PM
Whatsthatcat?
 
25 posts · Mar 2009
Hi All,

I wanted to reply to this thread:
http://forum.bytesforall.com/showthread.php?t=3513

But it was closed, so I found this one. I am also adding a link in the page menu, and added the code flynn suggested at the end of functions.php. I am, however, getting these errors:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-login.php on line 337

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-login.php on line 349

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 690

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 691

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 692

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 890

Whenever I do anything. Using newest atahualpa, 353, and WP 301
  #21  
Old Sep 4, 2010, 06:07 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
check to see if the first or last line of the file is a blank. if so delete it
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #22  
Old Sep 5, 2010, 09:17 PM
Whatsthatcat?
 
25 posts · Mar 2009
No Dice! I checked again, added the code and saved, and went back to the site and edited for a little while but then got this:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:796) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 890

THEN I took out the offending bit of code, made sure no spaces were there, and re-saved. Now when I attempt to log in I get this:


Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-login.php on line 337

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-login.php on line 349

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 690

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 691

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 692

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/im/imandyhaynes.com/wp-content/themes/atahualpa353/functions.php:1) in /var/www/html/im/imandyhaynes.com/wp-includes/pluggable.php on line 890

Please help! Attaching file with the replace menu link code in.
Attached Files
File Type: zip functions.php.zip (8.3 KB, 2280 views)
  #23  
Old Sep 5, 2010, 09:20 PM
Whatsthatcat?
 
25 posts · Mar 2009
Also, a maybe helpful update:

Whenever I copy over the functions PHP from my backup unedited atahualpa theme files all the errors go away, so something is going on. I just don't know what, because I checked the encoding and everything. I am editing in TextWrangler on a mac, btw.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't make a link work on a page. Imawebgirl Forum How-To 8 Oct 24, 2009 09:12 PM
[SOLVED] How do I make one custom link in the Pages Menu? iPuppet Page & Category Menu Bars 7 Sep 24, 2009 01:22 PM
Single Post Pages--How to make post title a link? chainpin Atahualpa 3 Wordpress theme 4 Aug 20, 2009 02:02 PM
How to make the Pages display in sidebar, show only the Parent Main Pages Leoni Sidebars & Widgets 2 May 27, 2009 01:13 AM
Adding custom pages to menu FH4U Page & Category Menu Bars 2 Feb 9, 2009 03:31 PM


All times are GMT -6. The time now is 11:05 PM.


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