how to add widget in submenu of wordpress theme - wordpress

I want to add widget in second layer of wordpress menu. and it should be changable from admin panel. as for example if i add calendar widget in second layer than it can be move to another menu or should be able to add another widget.

It might be a little too late, but here's the solution I've found to this problem. It might still be helpful to someone out there ;P
First I tried making use of the Max Mega Menu plugin, it was giving too many features I didn't need besides the ability to add widgets to the menu.
But the following plugin takes care of that in a very simple and practical way: Widgets in Menu.
Give it a try, this one did it for me ;)

Related

wordpress admin menu. naming of sub menus

I'm trying to figure out how one would add a custom top level admin menu with a handful of submenus without having the top level one repeat itself in the submenus.
This is what i want:
Posts
All Posts
Create
etc.
Click on posts and get to the "all posts" page. All I'm getting is:
MyPostType
MyPostType
etc.
I want it to be MyPostType > All MyPostTypes.
Hope somebody can help. I'd appreciate it! thanks
//EDIT
Trying to rephrase here (seems like people don't get my question, sorry for my lacking language skills)
I'm talking about the left hand menu in the admin area
I'm not looking for a plugin to make changes to that menu, I'm looking for code
of course I'm trying with add_menu_page and add_submenu_page but I can't get them to do what i want.
here it is again:
Using add_menu_page('MyPostType',...) and add_submenu_page('Options',...) gets me a top level menu entry called MyPostType with two submenu entries called MyPostType and Options. If you look at e.g. the Posts top level menu entry, they somehow managed to rename Posts(Submenu) to All Posts. That's what I want:
MyPostType
All MyPostTypes
Options
hope someone knows how to do that. thanks!
Make sure you are using the add_menu_page() method and add_submenu_page() method.
What does your code look like at the moment?
So I figured it out by myself. her's how you'd do it.
use add_menu_page to create the top level menu entry. give it a slug to identify it.
use add_submenu_page to override the submenu entry created by add_menu_page. to override just give it the parents slug as the parent parameter. give it that exact same slug as the menu_slug parameter. that does the trick. now add as many more submenus as you want.

Wordpress - Only allow one Text Widget to be added

I'm in the process of trying to create a custom theme for Wordpress and managed to create a working widget area. But for the purpose of this theme, I would like to allow only one "Text-Widget" to be used. How would I go about limiting this?
Be specific about what you want to ask. Wordpress don't limit widgets you can use as much text widget.
Can you provide urls so we could advice a solution to you?
I'll update the code below to be compatible with your theme if you can give a url to your blog.
WordPress don't allow you to limit the number of widgets but you can use javascript to hide the next sidebar items.
$('.sidebar li:gt(0)').hide();
the 2nd list item onwards will be hidden.
and yeah, this is a bit of cheating though.
SEO wise the next widgets are still visible.

Custom Menu Link Descriptions

I am building a custom WordPress theme and need to add descriptions to my custom menu links. According to WordPress, there is a way to do this:
"The description will be displayed in the menu if the current theme supports it."
Does anyone know how to support this?
Thanks in advance,
Tim
Wordpress' documentation on this is misleading. It actually took me quite some time to find out how to do this myself. As long as your theme supports menus (meaning, you've Registered a Custom Menu within functions.php or elsewhere), you can add Link Descriptions and other useful information by default.
In order to SEE these options, go to Appearance->Menus and click on Screen Options (up in the top right-hand corner of the screen). You will be able to enable the options you like under "Show advanced menu properties".

Where to start in editing a wordpress plugin?

I am a newbie in wordpress and I was given the opportunity to edit a certain plugin which is MarketPress, but then I had hard times dealing with it since I'm new to this thing and I don't know where exactly to go, I would want to edit an included dynamic_sidebar but I can't the file on where to edit this. Please help me. :(
Thanks.
Not sure of your level of understanding so forgive me if this is over-simplistic.
The sidebar content is driven by widgets, which is controlled from the Widgets admin panel. The only thing about a sidebar that you should be able to edit by messing with its definition are the wrapping markup for the whole widget and for the title, along with the sidebars name and description. The last two only effect text that shows up in the admin Widgets panel.
However what I describe above is not found with the dynamic_sidebar() method, rather with the register_sidebar() or register_sidebars() methods. These 'define' the name and settings for a sidebar. The dynamic_sidebar() method is the used to implement the sidebar by passing it that sidebars name.
The sidebar is then populated with widgets via the admin Widgets panel.
Typically sidebars are registered from within the functions.php file of a theme, but if a plugin contains templates there no reason why it couldn't also have its own sidebars. As for where the register_sidebar() function is being used in your plugin specifically, I couldn't say. Just search through it using whatever IDE you like, or grep if your comfortable with it.
Hope this helps.

Drupal: how to move node comments under Read More link?

My Drupal is displaying a simple custom view, with a nodelist.
The trick is that my view displays comments under nodes in the list.
That is too much for one page and I need to get a list of pure nodes and hide comments under ReadMore link.
I've tried to play with comments settings for my the custom node type I am displaying,
but even if I choose "Display on separate page" - the comments themselves still remain in the main grid.
How to I move comments under ReadMore link to make them invisible in the grid?
Ahh the joys of theming views.
View Theming guide
This guide should be enough to get you started.
I'd recommend using the views-view-VIEWNAME-field.tpl.php as opposed to writing a theme function.
Hope this helps

Resources