Edit the Wordpress sidebar with personalized content - php

I am creating a plugin for Wordpress. I'm in doubt which hook I need to call to add custom content to the Wordpress side menu bar.
I want to add a widget with a chart over there.
I already researched, but I didn't find anything about it. It would be better if I didn't need to change the files in the sidebar but rather do everything for my plugin.

You're looking for two functions add_menu_page and add_submenu_page
Detailed instructions are here:
https://developer.wordpress.org/reference/functions/add_menu_page/
https://developer.wordpress.org/reference/functions/add_submenu_page/

Related

How to make a dynamic wordpress page (custom control/page template box)

I have completed numerous wordpress template tutorials focusing on implementing multiple pages, and a custom dynamic navigation. The only issue I have is finding a source on creating a custom template box. For example, my goal is to customize the page template box following the mock up. The content placement is done in php, and designed in css. That way I dont have to add content in php but instead add it in wordpress based on my custom design. I have not found any source to achieve this. Does anyone have a source that displays how to create custom template boxes(the dynamic part)?
Links below is what I used to create my wordpress site
https://www.smashingmagazine.com/2013/05/migrate-existing-website-to-wordpress/
custom navbar for wordpress using bootstrap
I tried another source called Dynamic Page Templates in WordPress, Part 2 which suppose to explain how to create custom controls/template boxes. Following the link was unclear, resulting in not achieving the goal.
Thanks,
There are many ways to create a dynamic page in WordPress. I am sharing one of it. Install Advanced Custom Field Plugin and read its documentation. It allows page content to be changed from back-end (Its great for text/images). For areas where you want to user to choose whatever custom widget she wants to choose, add a widget area following any custom widget tutorial.

How to get submenu dropdown with images in wordpress?

I'm a very beginner in wordpress.
I need to add submenus with images in wordpress. Let's assume Main menu has menu1, menu2, menu3, ...etc. and I need to add submenu1, submenu2, submenu3, ...etc under the menu2 as sub dropdown menus with featured images. Can anyone tell how to do that in wordpress?
Can I use two menu plugins simultaneously?
You should look for a mega-menu plugin or maybe use a custom theme that already includes one.
this one is free and wellknown: https://de.wordpress.org/plugins/megamenu/ (wellnown is important because of the docu and the community if you need help). This will be the easiest thing if you're new to wordpress.
Correction after talkin to lee. He / she is right. The following part is the 'advanced" solution.
I, after 10 years of WP development, would code my own function, hooking into the wordpress image uploader. Many scripts are allready included in wordpress / many functions are working out of the box. Image upload is one of those scripts / functions.
So you can enqueue the script that wordpress delivers (see following link, 'Default Scripts Included and Registered by WordPress' > 'Media Upload'):
https://developer.wordpress.org/reference/functions/wp_enqueue_script/
As a real example how to implement it, would be way too much in this answer, I am giving you this link: http://code.tutsplus.com/tutorials/getting-started-with-the-wordpress-media-uploader--cms-22011 (usually i wouldn't paste a link as a answer, but as this is a side-answer / tip i guess it's okay).
All the best

Wordpress - creating custom pages with php code

I need to add few additional pages to my wordpress site.
These pages should not be "part of the site", ie they should not be linked somewhere from the posts and so on.
However, they should have the same header/footer as the rest of the site ( I am using custom theme ). And they should be accessible via url.
The final requirement is, I should be able to code in php.
At the moment, I tried to create a new "Page" in my admin console. And then write some php-code inside. However, all my php code gets commented and since not executed.
I don't think that installing plugins such as Exec-PHP is a good idea, so I am trying to find other solutions.
Any comments/advice/suggestions how to make it?
I would be grateful if you give me some how-to link.
Thank you in advance.
You can use a custom page template in your theme for this and just keep the site empty in the admin panel:
http://codex.wordpress.org/Theme_Development#Custom_Page_Templates
By using Template tag's you can create custom page.
write this code on the top of your php file....
/*
Template Name: Your Template Name
*/

Adding Widget to Wordpress Admin Post/Page Edit Sidebar

I'm trying to find the proper way to add a custom widget to the sidebar on the post/page editor page, specifically, in the sidebar under the 'Page Attributes' section. I've been searching various keywords and coming up short. The Wordpress codex docs are limited, so I'm having any luck there either.
If there is a hook that can be used, what is it?
Else, the Wordpress functions needed to add the new control.
I'm guessing that the meta boxes are only displayed under the post section, so that wouldn't be the area I'm looking to edit.
Also, would using the Widget class be the wrong thing to do?
I'm developing for version 2.8 or higher.
You should pose that question on https://wordpress.stackexchange.com/
In short: Widgets on the editor pages are not widgets, don't use the frontend widget class for them. They are functions (callbacks) you need to register for the editor pages. You can differ between post and page and in later WP versions between the post type as well.
The function to add the meta box to the editor pages is: add_meta_box

php code for each wordpress widget?

I'm currently changing my theme and I need each individual code of each widget.
For example I need the rss widget, or categories widget or comment widget, etc.
I want those widget integrated in my footer.
Where can I see the code? I have no idea where to begin look...
I'd recommend creating multiple sidebar regions in your footer. You can make as many as you like, so just make one for each widget you'd like to have in the footer.
This way, you benefit from updates to the core widgets when WordPress tweaks them.

Categories