wordpress-plugin

Passing Class Method as a Call-Back Function in WordPress

空扰寡人 提交于 2020-01-01 00:45:07
问题 I'm looking for a way to pass a class method to a call-back function parameter. I usually use create_function() as follows but I've heard it is slow and makes it difficult to debug. add_action('init', create_function('', '$o = new AdminPageClass;')); class AdminPageClass { function __construct() { add_action('admin_menu', array(&$this, 'admin_menu')); } function admin_menu() { add_options_page( 'Sample Admin Page Class', 'Sample Admin Page Class', 'manage_options', 'sample_admin-page_class',

WordPress plugin development using OOP

故事扮演 提交于 2019-12-31 21:59:51
问题 I am new to plugin development. So please correct me, wherever I get it wrong. I have a website which needs a players plugin with the following needs:- An administrator controllable form for player registration, with some details of them. A listing page where all the registered players are to be shown. Registered players can be deleted & compared with each other. Showing some registered players (10 random players) in the WordPress theme in the front-end. I have completed the activation of the

WordPress plugin development using OOP

≡放荡痞女 提交于 2019-12-31 21:59:12
问题 I am new to plugin development. So please correct me, wherever I get it wrong. I have a website which needs a players plugin with the following needs:- An administrator controllable form for player registration, with some details of them. A listing page where all the registered players are to be shown. Registered players can be deleted & compared with each other. Showing some registered players (10 random players) in the WordPress theme in the front-end. I have completed the activation of the

WordPress Admin: When placing a Custom Post Type as a submenu of a parent menu, the parent menu link is being overridden by the CPT

谁说胖子不能爱 提交于 2019-12-31 17:25:04
问题 I register a Custom Post Type, and I don't want it to have its own menu, instead I want to place it as a submenu of an existing admin menu item called my-custom-parent-page . Here's my code: register_post_type('my_custom_post_type', array( 'labels' => array( 'name' => __('Books', 'mcpt'), 'singular_name' => __('Book', 'mcpt'), ), 'supports' => array('title', 'editor'), 'show_ui' => true, 'show_in_nav_menus' => false, 'show_in_menu' => 'my-custom-parent-page', ) ); It works, meaning that it's

WooCommerce - where can I edit HTML generated by hooks?

我与影子孤独终老i 提交于 2019-12-31 08:08:10
问题 I'm new to WooCommerce. Anyhow, I want to create my own theme, so I followed the guidelines and copied accross the core template files to /mywordpresstheme/woocommerce/ . That all works great and I'm editing the templates just fine. However, the way hooks and actions work in WooCommerce is baffling me and I can't work out where certain parts of generated HTML are coming from. For example, in content-product.php , there is a hook that gets the image: <?php /* * woocommerce_before_shop_loop

Add Advanced Custom Fields to WooCommerce Product Variation

家住魔仙堡 提交于 2019-12-31 03:59:13
问题 I am using plugins called Advanced Custom Fields (ACF) and WooCommerce. I want to create a text and image field for WooCommerce product variation. I created fields in ACF and assigned them to "Post Type" > "product_variation" . But for I don't see these fields under product > Variations . I searched and it looks like I have to write a custom code to accommodate these fields. I tried searching the problem and most of the suggestions and tutorials I founds are about creating custom fields via

How to get DOCUMENT_ROOT to work on both localhost and web host?

怎甘沉沦 提交于 2019-12-31 02:53:11
问题 I have a WordPress plugin that I would like to work on localhost as well as in deployment without modification, but I can't seem to set the location for a directory using one statement. I would like to do this: $feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/wp-content/cache'); While that works on the web host. On localhost it produces this error: C:/xampp/htdocs/wp-content/cache/a547b8792c3144c98549be23ef1465e7.spc is not writeable On localhost, I need to set it to this to get it

Visual Composer Grid with do_action shortcode is not working

狂风中的少年 提交于 2019-12-30 08:38:07
问题 I have visual composer which is packed with total theme. When I put the following grid short code in my page in the editor it works correctly. [vc_basic_grid post_type="post_type" max_items="10" item="masonryGrid_SlideFromLeft" grid_id="vc_gid:1458178666639-80ebf3775500c87d35de078c3422fe96-10" taxonomies="555"] However, when I call the exact same code using do_action it gives the following javascript error. I checked the html output and it is the same using do_action like putting the short

Plugins menu doesn't appear in the admin panel

☆樱花仙子☆ 提交于 2019-12-29 06:43:24
问题 I'm having a very simple problem. I'm new to WordPress and I'm trying to install a plugin. Everyone says there's a "plugins" option on the sidebar-menu in the admin panel, but I don't see one! I've looked for it in all the sub-menus too. Whenever I try to search for this problem, I get results about creating a plugin to show on the admin menu. Anyway, how can I get the plugins menu to show up? 回答1: The issue is almost certainly related to one of two things: 1) You don't have permissions (are

How to go about modifying the Wordpress “Pages Add New Screen”

末鹿安然 提交于 2019-12-29 01:22:33
问题 I have been thinking about developing my own theme framework for worpdress. I'd like to use jquery ui to build a bootstrap 3.0 drag and drop interface, which I already have worked out, but I can't figure out how to edit the "Pages Add New Screen" as referenced here: https://codex.wordpress.org/Pages_Add_New_Screen Would I add files to my client side theme that affected my admin structure as well? Does anyone have any suggestions as to how to do something like this. Alot of themes these days