Solved

WordPress: php in text widgets

Posted on 2010-09-10
19
430 Views
Last Modified: 2012-05-10
Hi all,

I'm using the Atahualpa theme and am trying to figure out how to create a left sidebar vertical menu of pages. I would like the default state (i.e., from the home page) to show the top level pages, and then show the sub-pages inside a given section, when the user clicks on the top link for that section. I have some PHP that does what I want, but I can't get the PHP to work inside the text widget that I've placed into the left sidebar. I've installed the PHP-exec plugin but it doesn't seem to do anything.

(Ideally, I would like the menu to open up as a show/hide accordion-style menu so that when you click on one of the top-level items, it opens up to show its sub-items, but that may be too much to ask.)

Thanks in advance for any help.
0
Comment
Question by:lauras2010
19 Comments
 

Author Comment

by:lauras2010
Comment Utility
I've increased the points because so far I haven't been able to find anything about this, anywhere on the internet ...
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
I will install it on my testing server, so I can be more precise with instructions. I will get back with you
when or if I find a solution.
0
 

Author Comment

by:lauras2010
Comment Utility
Great -- thanks! Let me know what you find out (either way ...)

Laura
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
No problem, are you using Atahualpa 3.4.9, or Atahualpa 3.5.3? I don't know if it will matter, but just in case.
0
 

Author Comment

by:lauras2010
Comment Utility
3.4.9
0
 
LVL 23

Accepted Solution

by:
jeremyjared74 earned 500 total points
Comment Utility
Ok I have a vertical drop-down menu widget working. I don't know if it has all the options you want. It does allow you to choose the pages, it does allow you to have child pages. You will be limited to the amount of Atahualpa set amount of widgets which is four. This means you can have four separate configurations, but they will be in different areas. First, download this widget: http://wordpress.org/extend/plugins/dropdown-menu-widget/.

Next in the Atahualpa theme options Disable all of the Widgets except the ones you want to use. If you leave the left inner to show (by selecting the pages from the check-box area), you have to place the new drop-down menu. widget in the same position inside of the Admin Widget section.

After you choose which widget position you want your menu widget from Atahualpa config area, go to the admin widget area. From there look for the Drop-Down menu widget and drag it to the widget bar position you chose from Atahualpa settings. Click the widget to bring up the settings for it. At the bottom you will notice a link to Menu Style. Click it and you will go to a settings page. Read these instructions carefully for the ability to customize your new widget drop-down page listings. Let me know how it turns out.

Sorry about the pic, I know the site is ugly, I was trying to hurry.
dropdown-menu.png
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
By the way, I just installed 3.5.3, it has some cool new features. You may want to check it out. It has an animated menu for one. I haven't checked them all out yet.


Here is the link: http://wordpress.bytesforall.com/?p=94
0
 

Author Comment

by:lauras2010
Comment Utility
Well, just to be clear, before I do all the work to install and configure the new widget, what I am looking for is this: Just a list of top level items in the left sidebar. NOT a dropdown menu. I am looking for a list of menu items that looks like this:

=====
Home
About Us
Membership
Conferences
Education
Resources
=====

If you click on "About Us", then the list looks like this:

=====
Home
About Us
     Mission Statement
     History
     Board of Directors
     Contact Us
Membership
Conferences
Education
Resources
=====

That's all I'm looking for. Ideally, if the sub-menu could open up when you click on About Us without reloading the page, that's even better, but that might be too much to ask.

Again, I'm looking to have this all happen within the left sidebar column. I do not want a flyout menu (where the submenu items appear onmouseover in a layer to the right of the left column). And I definitely don't want a "vertical dropdown" menu (sub-items appear in a vertical list below a horizontal nav bar).

Does the dropdown-menu-widget do this? I can't afford the time to play with it if it's the wrong thing. I've had too many false starts already and I'm way behind.

Thanks very much for your help!
Laura S.
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
If you set the widget width to a small number it will do that. Set it to 100px or something. If you want to wait, I will be home this evening and I will try it first. I know it will work, because when I first set it up, I had it too thin and it was only two rows. If it were thinner, it would have been 1 row.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
OK, here are the settings along with an image of how it works. From what I can tell, this is what you are wanting. Good Luck, and let me know if you have any more questions.
Untitled-1.jpg
plugin-settings.jpg
Sidebar-Settings.jpg
0
 

Author Comment

by:lauras2010
Comment Utility
I'm offline all day today so will try to check into this tonight or tomorrow ... thanks and I'll keep you posted!

Laura
0
 

Author Comment

by:lauras2010
Comment Utility
Actually I looked again, and I don't think this is quite it. I don't want a javascript-style "fly-out" menu. I just want a list that looks like this:

=====
Home
About Us
     Mission Statement
     History
     Board of Directors
     Contact Us
Membership
Conferences
Education
Resources
=====

The "About Us" items (Mission Statement, History, etc) should not be a flyout menu -- it should just be part of the list, like an indented section to indicate that it's a sub-menu. I know that it's common to have dropdown or flyout menus in WP, so I'm going to assume that this is what you have ... and I'll wait to hear back from you to see what it is exactly before going any further.

Thanks!
Laura
0
 

Author Comment

by:lauras2010
Comment Utility
I rjust ead your post again and will try to put some time into this tomorrow or Monday to see if I can get it to do what I want. I'll let you know what I find out.

Thanks for all your help,
Laura
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
Sorry, I have been out for awhile. I don't think this is going to do what you want. I thought you wanted a fly-out sub-section. It is late for me, but Tomorrow I will try again.
0
 

Author Comment

by:lauras2010
Comment Utility
Thanks but it's probably not worth your time. I tried making the column narrower as you suggested but I'm displaying a background image in that column so it truncates the image. And in general it doesn't seem to be the way to go.

I'll award you some points anyway for being nice enough to spend the time and help out.

Thanks,
Laura
0
 
LVL 8

Expert Comment

by:Brandon Lyon
Comment Utility
FYI, it is surprisingly simple to make a widget. If you made your own you widget then you wouldn't need to place the php in a text widget. To create a widget just requires a little bit of theme editing.

This article seems pretty good at explaining the process.
http://www.lonewolfdesigns.co.uk/create-wordpress-widgets/
0
 
LVL 3

Expert Comment

by:mjjdesigns
Comment Utility
WordPress doesn't natively allow PHP to execute in a widget (text or otherwise).

If you need to do it, just install the ExecPHP plugin: http://wordpress.org/extend/plugins/exec-php/

Then your (working) PHP will do what you want.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Transferring a wordpress site from a host or local dev server to another host can be a pain. So I've included my steps on how I have accomplished this task. Steps include an assumption that you have Cpanel access or Ftp access.. If you do not hav…
WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now