rewrite file to wordpress

WordPress rewrite mechanism works in a different way, not like .htaccess rewrite rules. More information about it you can find in codex (Rewrite API, WP_Rewrite, etc.). But fast work around could be the following: First of all we need to register our query var and rewrite rule: function myplugin_add_query_var( $vars ) { $vars[] = ‘myplugin_api’; … Read more

Edit part of a post

The way WordPress is built now doesn’t really allow for that. The post content is all in one block in the database – one, continuous database field. While you might be able to break out sections of it by adding specific markup, you’ll still end up parsing the entire content to extract just that section. … Read more

Recent Posts+, how to solve multiwidget?

Easy, Anton! You don’t have to hack the database… Probably you can find a replacement for this plugin that uses the modern Widgets_API, responsible for the multi-instance widgets. At least as far as I know, because haven’t worked much with WordPress pre-2.8. If you are willing to hack something, hack the plugin using the examples … Read more

How to display results from a data table with an encrypted user id?

The plugin now works as I would like, with a little alteration. Instead of setting submitter_id to a random value, it is now set to the logged in user’s id. This will allow displaying other users’ answers. The + indicates new lines of code in the output_quiz.php file: function wpss_getQuiz($quiz_id){ global $wpdb; + global $current_user; … Read more

Running a function with args in add_action()

No, this cannot work. Haven’t you tested your idea? A simple workaround would be a class: class WPSE_53453_Action_Handler { public $tokens, $payloads; public function process() { $tokens = $this->tokens; $payloads = $this->payloads; // do something awesome } } $WPSE_53453 = new WPSE_53453_Action_Handler; $WPSE_53453->tokens = array ( ‘foo’, ‘bar’ ); $WPSE_53453->payloads=”hello”; add_action( ‘publish_post’, array ( $WPSE_53453, … Read more

Using plugin_dir_path() with WordPress on MAMP

I’m not sure why this isn’t working for you. I usually set the plugin path constant using dirname(FILE) You could try: define(‘MR_PLUGIN_PATH’, dirname(__FILE__)); //echo MR_PLUGIN_PATH; include_once(MR_PLUGIN_PATH.’/phprets.php’); Also: Are you sure phprets.php exists. You say you have phrets.php (missing the p)