I am making an option, that allows me to add the names of the pages I want to show in the footer, and here is what I need help with, basically I have a variable of allowed pages, which is pointed to the wordpress option where I list the pages, However, the foreach loop doesn't loop through each page I listed because it thinks it's all one string, I done this manually without creating an option and it work just fine, Ideally, I need an option so I don't have to edit code. heres what it looks like, maybe you guys can help me get it straightened out
wordpress coding question
5
I am making an option, that allows me to add the names of the pages I want to show in the footer, and here is what I need help with, basically I have a variable of allowed pages, which is pointed to the wordpress option where I list the pages, However, the foreach loop doesn't loop through each page I listed because it thinks it's all one string, I done this manually without creating an option and it work just fine, Ideally, I need an option so I don't have to edit code.
heres what it looks like, maybe you guys can help me get it straightened out
output: "contact us, about us" (Notice how this is outputted as a string)
thats the code that doesn't work right, I wan't it to list all the pages I got in the option, and the pages are set up in the options like 'contact us','about us','privacy policy' however the loop thinks its one string.
this is the code that worked before without the option, this looped through all the pages, and displayed them in a list, (I had them in an unordered list before).
output:
contact us
about us
privacy policy
that right there works perfect but for some reason it doesn't work when I use the wordpress option.
edits: the variables are blocked, but if you know PHP you should recognize the structure
heres what it looks like, maybe you guys can help me get it straightened out
PHP Code:
<?php
= array(get_option('allowed_pages'));
foreach ( as ) {
echo ();
}
?> thats the code that doesn't work right, I wan't it to list all the pages I got in the option, and the pages are set up in the options like 'contact us','about us','privacy policy' however the loop thinks its one string.
this is the code that worked before without the option, this looped through all the pages, and displayed them in a list, (I had them in an unordered list before).
PHP Code:
<?php
= array('contact us','about us','privacy policy');
foreach ( as ) {
echo ();
echo "<br/>";
}
?> contact us
about us
privacy policy
that right there works perfect but for some reason it doesn't work when I use the wordpress option.
edits: the variables are blocked, but if you know PHP you should recognize the structure
- phpbbxpert
- [ 1 ] Thanks
- scott33
- phpbbxpert
- scott33
Next Topics on Trending Feed
-
5