|
#1
Oct 27, 2009, 10:27 AM
|
|
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
Oct 27, 2009, 11:45 AM
|
|
|
|
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
Oct 27, 2009, 11:49 AM
|
|
LOL! That would help!
The latest of both: WP 2.8.5 and Atahualpa 3.4.1
Thanks!
|
#4
Oct 27, 2009, 11:54 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#5
Oct 27, 2009, 12:37 PM
|
|
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
Oct 27, 2009, 12:50 PM
|
|
|
|
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
Oct 27, 2009, 06:28 PM
|
|
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
|
#8
Oct 27, 2009, 07:22 PM
|
|
|
|
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
Oct 28, 2009, 09:59 AM
|
|
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
Oct 28, 2009, 12:15 PM
|
|
|
|
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
Oct 28, 2009, 04:11 PM
|
|
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
Oct 28, 2009, 07:58 PM
|
|
|
|
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
Oct 28, 2009, 08:26 PM
|
|
LOL! I hear that! Thanks so much for your time and all of the hand-holding...
KIP
|
#14
Oct 30, 2009, 09:22 AM
|
|
|
|
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
Aug 7, 2010, 12:24 PM
|
|
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
Aug 7, 2010, 03:53 PM
|
|
|
|
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
Aug 7, 2010, 04:06 PM
|
|
I can do that within the Atahualpa theme? Cool! I didn't realize that! I'll go check it out! Thanks!
|
#18
Aug 13, 2010, 12:14 PM
|
|
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
Aug 14, 2010, 06:54 AM
|
|
|
|
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
Sep 4, 2010, 12:31 PM
|
|
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
Sep 4, 2010, 06:07 PM
|
|
|
|
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
Sep 5, 2010, 09:17 PM
|
|
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.
|
#23
Sep 5, 2010, 09:20 PM
|
|
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.
|
|