Can I create my own “Recent Posts” widget or customize the existing one?

It’s usually best to copy the existing one, name it something unique, and then add your own functionality. Copy the WP_Widget_Recent_Posts class from wp-includes/class-wp-widget-recent-posts.php into your functions.php (or, preferably, another file in your theme devoted just to widgets) and rename to something else, like My_Widget_Recent_Posts Add your functionality in there. Don’t forget to call register_widget(‘My_Widget_Recent_Posts’) … Read more

wp_redirect() – headers already sent

Found the answer (via) Instead of using the function I added an action to “wp_loaded”, that makes sure that it gets loaded before any headers are sended. <?php add_action (‘wp_loaded’, ‘my_custom_redirect’); function my_custom_redirect() { if ( isset( $_POST[‘subscribe’] ) ) { $redirect=”http://example.com/redirect-example-url.html”; wp_redirect($redirect); exit; } } ?>

Theme Activate Hook

I have that code here just name the file theme_activation_hook.php like on the website and copy this. <?php /** * Provides activation/deactivation hook for wordpress theme. * * @author Krishna Kant Sharma (http://www.krishnakantsharma.com) * * Usage: * ———————————————- * Include this file in your theme code. * ———————————————- * function my_theme_activate() { * // code … Read more

Minimum Template Files for Theme Development

To have the theme listed: style.css With at minimum this: /* Theme Name: Minimum Theme Description: Test Author: Test Version: 1.0 */ For the theme to be functional: index.php index.php must have a post loop, so this would be the bare minimum functional index.php <html> <head><?php wp_head(); ?></head> <body> <?php if ( have_posts() ) { … Read more

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