How do I make one custom link in the Pages Menu?
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 |
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. |
LOL! That would help!
The latest of both: WP 2.8.5 and Atahualpa 3.4.1 Thanks! |
Atahualpa is at 3.4.4 - see http://wordpress.bytesforall.com/?p=81
|
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! |
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. |
1 Attachment(s)
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 |
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. |
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 |
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); |
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 |
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....
|
LOL! I hear that! Thanks so much for your time and all of the hand-holding...
KIP |
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'); ?> ?> |
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 |
Why don't you make a splash page and use it as the home page
There are directions in the gold forum tutorials |
I can do that within the Atahualpa theme? Cool! I didn't realize that! I'll go check it out! Thanks!
|
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 |
try this, code a home.php and just put your page's html in it...
|
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 |
check to see if the first or last line of the file is a blank. if so delete it
|
1 Attachment(s)
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. |
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. |
All times are GMT -6. The time now is 02:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.