wordpress-plugin

How does plugin system work (wordpress, mybb …)?

浪子不回头ぞ 提交于 2019-12-17 10:32:38
问题 I'm curious how plugins work, I just know that instead of changing the code we use plugins, but how do they do their job without changing the code ? and what should a coder consider when coding a new project so it can have plugins ? and thank you very much :D 回答1: There are multiple variations on how to implement a plugin system. Wordpress uses a quite common scheme often described as "hooks." I don't know the exact implementation but it basically works like this: // plugin.php script

Inserting data into a WordPress table on form submit, using PHP

試著忘記壹切 提交于 2019-12-16 18:06:12
问题 I have a form with some fields, and a wpdb table which corresponds to the fields. I want the data from the form to be submitted into the table when the submit button is clicked on the form. Here is the form: function display_form(){ echo ' <form action="insertrow.php" method="post"> <p>Ticket id: <br /> User id: <br /> Description: <textarea class="widget" rows="4" cols="1" name="ticket_description"></textarea> Priority: <select name="ticket_priority" placeholder="Select"> <option value=

Passing Extended Class Method as a Call-Back Function in WordPress

无人久伴 提交于 2019-12-14 03:34:57
问题 This is a continuation of this question. When the class is extended, it refers to the original class method. The echoed class name in the created page should be AnotherAdminPage which is the extended class name. /* Plugin Name: static method callback demo */ class AnotherAdminPage extends AdminPageClass { } add_action('admin_menu', AnotherAdminPage::_admin_menu()); class AdminPageClass { static function _admin_menu() { $class_name = get_class(); $classinstance = new $class_name(); return

Enqueue jquery-ui elements in Wordpress theme option page

谁说胖子不能爱 提交于 2019-12-14 02:57:56
问题 Well, I know this is a commonly asked question, but almost all of them like '2 or 3 years ago'. Since Wordpress had some serious core changes recently, thought it'd be better to get an updated answer. What I wanted to do is add this jquery slider to my wordpress custom admin page. In today's Wordpress, is jquery-ui coming in built ? or I do need to include it using wp_enqueue_script or I should use some external url CDN? Since I'm working on Wordpress 4.2, could you please tell me the proper

WooCommerce Extending WC_Shipping_Method error: Class 'WC_Shipping_Method' not found

a 夏天 提交于 2019-12-14 02:55:35
问题 The title explains it pretty well. I'm trying to add a new shipping method (cost-based shipping) by extending the class. Here is the plugin body (The rest is in comments and contains the plugin info): class WC_Cost_Based extends WC_Shipping_Method { function __construct() { $this->id = 'cost-based'; $this->method_title = __('Cost-Based', 'woocommerce'); } function calculate_shipping() { $rate = array( 'id' => $this->id, 'label' => $this->title, 'cost' => '10.99', 'calc_tax' => 'per_item' ); /

Wordpress: Advanced Custom Fields Plugin strips out <p> tags?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 21:28:30
问题 I am using the ACF plugin (2.1.4 - latest version) for WordPress (3.2.1 - latest version). Everything seems to work fine, except for when I use a WYSIWYG field. Any paragraph tags used are not saved to the database. TinyMCE is inserting them when I go to the HTML view, but as soon as I save and look in the DB tables, no paragraph tags are found. This does not seem to affect other HTML like 'strong' tags etc however, interestingly enough, it does seem to affect 'br' tags as well. When I save a

Activating reveal.js in WordPress 4.2.2

…衆ロ難τιáo~ 提交于 2019-12-13 20:05:50
问题 I want to use reveal.js in the WordPress theme of my website, which uses WordPress 4.2.2. I followed the instructions by alleyinteractive here. I downloaded reveal.js for WordPress. I extracted it into public_html/wp-content/themes/revealjs-wp-theme-master . I downloaded Fieldmanager plugin and extracted the zip file into public_html/wp-content/plugins/wordpress-fieldmanager-1.0.0-beta.2 . I can see the theme in wp-admin as shown below: However, I am afraid to activate the theme as I may lose

How can I initialize wpdb class in a php file?

ぐ巨炮叔叔 提交于 2019-12-13 15:23:11
问题 i am new in wordpress. i want to run a sql from a php file and this file is calling from a plugin file. my plugin file code is: if (confirm('Are You Sure You Want to Delete?')){ window.location.href = '../wp-content/plugins/delete_data.php?id=<?php echo $db_data['dynamicmenu_id']; ?>'; } else{ } and this code is running from script. my delete_data.php file code is given below: dlt_opt(); function dlt_opt(){ global $wpdb; var_dump($wpdb); $dlt_id = $_GET['id']; $result = $wpdb->query( $wpdb-

plugins for WordPress that allow anonymous users to post entries [closed]

廉价感情. 提交于 2019-12-13 08:58:30
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Are there any plugins for WordPress that allow users to create blog posts without registering and logging in? 回答1: I use TDO Mini

How to create a plugin for take a backup of speific table in wordpress database?

本秂侑毒 提交于 2019-12-13 08:07:31
问题 Actually i download a plugin .This Plugin create some new tables in my word press database.Now i need to create a another plugin for to take a backup of table & data in that table created by the plugin i down loaded .(eg: i download a plugin name "b" and i activate it.It create table1,table2 table 3 in my wordpress site database. I worked in that plug in store some data s in table1 ,table2,table3 etc.I create a other plug in and it is linked to the downloaded plugin & now I need to take a