Facebook comments box on front page

Fast ‘n’ Hacky The problem can be solved by changing line 319 in facebook.php to the following: if (is_home()) { This way, the front page is not treated as a home page but as a regular page, for which the facebook feature settings can be applied (and will be handled correctly). More Elegant/Complex Here is … Read more

Fatal error: Call to undefined function wp_get_current_user()

wp_get_current_user() is a pluggable function and not yet available when your plugin is included. You have to wait for the action plugins_loaded: Example: add_action( ‘plugins_loaded’, ‘wpse_92517_init’ ); function wpse_92517_init() { if(!is_super_admin()) add_action(‘widgets_init’,’my_unregister_widget’); } function my_unregister_widgets() { unregister_widget( ‘WP_Widget_Pages’ ); unregister_widget( ‘WP_Widget_Calendar’ ); } Or move the check into the widget function: add_action( ‘widgets_init’, ‘my_unregister_widget’ ); … Read more

Using MathJax in text

To create an inline formula in LaTeX we can use single dollar signs $: This formula $x=y+z$ is inline. To display math on its own line, we can use double dollar signs $$: $$ a = b + c $$ Here is an example with Simple Mathjax installed: This will be displayed like this:

Simple form that saves to database

For what I can understand you already have the table in your database. I don’t know how you have named it, but a best practise (for me a must-do practise) is to name it with the same table prefix of wordpress, that’s the one setted in wp-config.php. You also don’t say how this table is … Read more

Coding Challenge – JavaScript Easter Egg

The following plugin dynamically hides the two offending radios using jQuery, and kills revision self-comparisons. <?php # Plugin Name: Pest Control # Plugin URI: http://www.semiologic.com/ # Description: Kills the Easter Bunny # Version: 1.0 # Author: Denis de Bernardy # License: Public Domain class PestControl { public static function bootstrap() { add_action(‘admin_head-revision.php’, array(__CLASS__, ‘mixomatosis’)); add_action(‘load-revision.php’, … Read more

How Does WordPress Uninclude/Deactivate A Plugin?

The active plugins are stored in the ‘active_plugins’ option, like this: array( ‘akismet/akismet.php’, ‘hello-dolly.php’, ); On each page load, WP just loops through that array and includes those files. It’s up to each plugin to include any additional files that it may have. When a plugin is deactivated, it’s just removed from that array. On … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)