Solved

WordPress: php in text widgets

Posted on 2010-09-10
19
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
19 Comments
 

Author Comment

by:lauras2010
ID: 33648891
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
ID: 33650380
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
ID: 33650941
Great -- thanks! Let me know what you find out (either way ...)

Laura
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 23

Expert Comment

by:jeremyjared74
ID: 33651020
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
ID: 33651240
3.4.9
0
 
LVL 23

Accepted Solution

by:
jeremyjared74 earned 500 total points
ID: 33651266
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
ID: 33651321
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
ID: 33652546
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
ID: 33652745
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
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 33652839
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
ID: 33653119
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
ID: 33655199
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
ID: 33655500
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
ID: 33655515
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
ID: 33661510
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 9

Expert Comment

by:Brandon Lyon
ID: 33962326
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
ID: 35282833
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
ID: 36487344
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

734 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