I am currently writing a plugin for my client in wordpress. The issue I am having is when a user clicks on edit to change a record I am not sure how to create the admin link to do this.
i.e.
Edit
function wpsc_product_seo_details()
{
echo "<h2>Hello</h2>";
}
I know my markup for the tag is probably wrong but I was just testing. Do I need to register a hook to do this.
The hook you are looking for is to add actions to the sidebar; there are various ways - add_options_page will add to the options menu, for example. add_menu_page will create a new group for you to add your links.
Check the documentation on adding admin menus for more information.
Related
I have a problem on on wordpress website: achordapp.co.il/alon
I need to let users add comments on the events that in the calnedar. i'm publishing events and they need to approve it.
I already try to set there the wordpress comments section which wasn't working.
I thought maybe i could add a form (even on popup) that will update the wordpress relevant information.
front:
https://imgur.com/a/Ke8CtP0
backend:
as text- [approve/not] [text]
Thanks!
See https://codex.wordpress.org/Function_Reference/add_post_type_support
If you add 'comments' support programmatically, then users will be able to add comments just like they can on normal posts.
I have a Wordpress website and want to add custom flow of registration.
The current website has these pages but I am not sure if there is any plugin that has inbuilt such flow feature or how to add this feature.
Any help appreciated.
I had to do a similar modification.
Your case seems the same as mine, its a single form, split onto steps for helping users/validations.
I didn't found any plugin ready for all i needed (the steps thing), and mainly ... hooks to change registration form in wordpress just add extra fields to standard fields, i needed to completly remix the order, so I went the javascript way:
Added my custom css and JS to login/register pages with the action 'login_enqueue_scripts'
Added my custom fields to form using 'register_form' action
Added a class to login body with 'login_body_class' filter, to keep things hidden while JS magic happened;
I'm not sure what's your skill level in JS, but once you got those hooks ready you can make pretty much whatever you want with the register form.
I have some custom wordpress migration, where there are a few custom plug-ins.
The problem which I am facing is that I have add new team member as link the folling link:
Add New
so when I press that button I am getting the form but no input fields are presented.
The question is more of where to be looking in order to resolve this, since it is using admin.php wordpress functionality? Any suggestion or guidance will help. Thanks.
A late answer but...
Some key guidance is given in Admin Screen Reference. See:
Top level pages admin.php?page={page_slug} toplevel_page_{page_slug}
Sub pages admin.php?page={page_slug} {parent_slug}_page_{page_slug}
So, you are working with either a (top) menu page or a sub menu page.
You need to search for calls to add_menu_page() and add_submenu_page() that pass wb_team_list as $menu_slug. The $function passed in the function call generates the page content.
(The answer was verified against the theme I am currently working with.)
I have a Wordpress site very customized where there are a lot of contributors and lots of posts are published. When you try to publish/update a custom post it displays a popup saying "The changes you made will be lost if you navigate away from this page. Are you sure you want to leave this page?".
This only happens when the modified/new content of the post is in custom fields corresponding to "Advanced Custom Fields" plugin. This popup is very annoying for the contributors. So I would like to know if is possible to disable this popup or any way to fix that.
Thanks.
Ok, so I was able to track down the cause. It is a JS function in ACF called unload.
All you have to do is add some JS:
jQuery( document ).ready( function() {
// disable the ACF js navigate away pop up
acf.unload.active = false;
} );
Reference:
http://support.advancedcustomfields.com/forums/topic/how-to-disable-js-alert-in-acf_form/
A more general answer in regards to WP's confirmation dialog:
Within wp-admin/js/post.js of WordPress-4.8 on line 481 you can find the mechanism behind the "navigate away" confirmation dialog.
The event: beforeunload.edit-post is initiated via jQuery's .on() function. jQuery gives you the ability to unbind event handlers via the .off() function.
By adding the following to your Javascript, you can disable this confirmation dialog when needed. WordPress itself also uses it when you hit the submit (Publish) button on a post for example.
// Prevent WP from asking confirmation to navigate away from the current post.
jQuery(window).off( 'beforeunload.edit-post' );
P.S. WordPress specific questions should be asked at: https://wordpress.stackexchange.com/
jQuery(document).ready(function()
{
jQuery(window).off("beforeunload", null);
});
Still valid on wordpress 5.9
So, I was trying to track down how WordPress itself handled this.
Here is what I found out:
There is an eventListener on publish or edit button of WordPress.
That actually runs the below code:
jQuery(window).off("beforeunload.edit-post")
So, Using the same way you also can disable that.
I am very much new to wordpress and need help. Well I need to add a custom field to woocommerce product listing page in admin and make it work.
So where do I have to make changes in code or in admin section.I need some suggestions on how to make it work.
Thanks in advance
if I'm understanding you right you want to add new fields to your woocommerce products, and you want those fields to show up in the admin panel. I am working on this right now myself and I have found a few good resources.
First of all, although I can't find any documentation on them yet directly in the woocommerce API docs, there are two hooks for extending the admin panel.
woocommerce_product_write_panel_tabs - this allows you to insert a new tab within the admin panel. from browsing the source of various free woocommerce plugins that do this it appears that the tab format should be <li>Tab Name</li>.
woocommerce_product_write_panel - this is where the insertion of your custom panel contents would go, placed within a <div id="#tab_name"></div>
These are the two hooks that I have had a great deal of difficulty locating. They allow you to hook into the actual woocommerce admin area, otherwise custom fields you might add will end up in a separate panel.
For all the details on actually adding the custom fields themselves and hooking them up to the front-end, I suggest this tutorial here, which covers the basic concepts involved in adding a new meta-data field and hooking it into the product display (in this case the single-product detail view, it sounds like you want to modify them in the list view but this will show you the basic principles).
http://www.xatik.com/2013/02/06/add-custom-form-woocommerce-product/
Note: that tutorial doesn't use the woocommerce admin panel but creates its own panel, the instructions I gave above, plus this tutorial, should get you just about anywhere you need to go.