wordpress-plugin

Matching text between braces in PHP

廉价感情. 提交于 2019-12-03 16:29:56
In direct follow-up to this previous question , how can I pull the text (and the braces if possible) out as a match using PHP? Specifically, I am writing a Wordpress plugin and am looking to reformat all text between two curly braces (a quasi wiki-marking). I've followed the steps outlined in another previous question I asked, and have the matching part working - it's the match I need help with. Example: This is some {{text}} and I want to reformat the items inside the curly braces Desired output: This is some *Text fancified* and I want to reformat the items inside the curly braces What I

How to check if the current page is a plugin admin panel in wordpress

风格不统一 提交于 2019-12-03 15:14:37
Please I want to know how to check if I'm currently in admin page of a plugin. I've created a plugin with a menu item which displays a page containing some stats of this plugin use, for that, I'm using custom JQuery plugins, some CSS, which I will never use outside of this page. So I wonder to know how can I check this, to enqueue or not plugin's styles and JSs . Here is my enqueue style code function bridge_style_enqueuer() { wp_register_style( "bridge_display_style", WP_PLUGIN_URL.'/symfony-bridge/chosen.css'); wp_register_style( "bridge_display_style_tb", WP_PLUGIN_URL.'/symfony-bridge

How to pull in Facebook Page posts as blog posts to WordPress?

不问归期 提交于 2019-12-03 15:00:48
问题 After much struggle with getting Facebook to yield it's RSS feed for a page, it seems as though my futility levels have reached their peak. JSON seems to work absolutely dandy for me and so to this end I am curious as to whether there are any plugins that would import FB JSON as blog posts since it seems that RSS XML's either going away or seriously b0rked. Can anyone recommend any plugins to accomplish this? 回答1: Another way to import facebook post in your blog is to use http://www

How do you use curl within wordpress plugins?

妖精的绣舞 提交于 2019-12-03 14:26:27
I'm creating a wordpress plugin and I'm having trouble getting a cURL call to function correctly. Lets say I have a page www.domain.com/wp-admin/admin.php?page=orders Within the orders page I have a function that looks to see if a button was clicked and if so it needs to do a cURL call to the same page (www.domain.com/wp-admin/admin.php?page=orders&dosomething=true) to kick off a different function. The reason I'm doing it this way is so I can have this cURL call be async. I'm not getting any errors, but I'm also not getting any response back. If I change my url to google.com or example.com I

Make WordPress WP-API faster by not loading theme and plugins

若如初见. 提交于 2019-12-03 13:46:32
问题 I would like to make requests to the WordPress API much faster. My API is implemented in a plugin (using register_rest_route to register my routes). However, since this is a plugin, everything is loaded with it (the child-theme and the theme) and basically a query to this API is taking half a second because of all this useless parts loaded. Doesn't WordPress API can be used in another way? Since most plugin making use of the WP-API doesn't need any other plugins to be loaded, even less a

Wordpress Plug-ins: How-to add custom URL Handles

社会主义新天地 提交于 2019-12-03 13:01:59
I'm trying to write a Wordpress Plug-in but can't seem to figure out how you would modify how a URL gets handled, so for example: any requests made for: <url>/?myplugin=<pageID> will get handled by a function in my plug-in. I'm sure this is a very simple to do, but I'm pretty new to working with Wordpress and couldn't find it in the documentation. add_action('parse_request', 'my_custom_url_handler'); function my_custom_url_handler() { if( isset($_GET['myplugin']) ) { // do something exit(); } } That should set you on the right direction. parse_request happens before WordPress runs any of the

How to include bootstrap in Wordpress plugin development?

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:18:34
I am developing the plugin, and I would like to include bootstrap in my plugin. What is the best way to include? I couldn't find anything related to this, so far I have found several bootstrap plugin, which I dont need, I need to include some js and css element from bootstrap in my plugin. I am new to bootstrap. Also I have tried something similar like including in WP theme, but it doesn't work? If you need more information, please ask me, I will provide you I have tried to include something similar to WP theme in the main file, index.php this : <script src="http://ajax.googleapis.com/ajax

Extending Contact Form 7 Wordpress plugin by using hooks

浪子不回头ぞ 提交于 2019-12-03 09:45:10
I would like to create a plugin that uses the contact form 7 hook, wpcf7_admin_after_mail. I want to use the plugin to interface with a CRM system. What I have thus far is the following: //plugin header here function add_to_CRM( $cf7 ) { if (isset($cf7->posted_data["your-message"])) { full_contact($cf7); } else { quick_quote($cf7); } return $cf7; } add_action('wpcf7_admin_after_mail', 'add_to_CRM'); //other functions here I can't seem to get this working. I can't even get the hook to work and do something like mail me. Anybody have any idea what I'm doing wrong here. Since I have limited

How to make sure changes to a Wordpress plugin won't be lost on plugin update?

假装没事ソ 提交于 2019-12-03 08:38:35
I'm pretty sure I've read somewhere that you can actually move the main plugin *.php file to somewhere else (I assume under your theme directory) to have it safe in case you made changes to it and your plugin updates. I tried Google but I can't find anything. Google page with good results will suffice. I've just experienced a situation where my 2 plugins which had its layout changed and accommodated my needs and I want to make sure it doesn't happen again. Apart from having the main file in another location, is there a way to move along any CSS and JS files as well? In Concrete5 CMS there is a

Add results into WordPress search results

孤街浪徒 提交于 2019-12-03 06:25:56
问题 I would like to add/inject/append extra results into the WordPress search results. At the moment WordPress only allows you to "adjust" the query that is being executed on its own database, but doesn't allow you to modify (or in WordPress lingo, filter) the results array. I.e: If in WordPress I search for the term 'potato' all posts related to this term come back. I want to include results that I've obtained via a different service into the WordPress results set. Just to clarify, I'm getting