How to set permalink structure via functions.php

You can set the permalink structure by calling on the set_permalink_structure() method of the global $wp_rewrite object. add_action( ‘init’, function() { global $wp_rewrite; $wp_rewrite->set_permalink_structure( ‘/%year%/%monthnum%/%postname%/’ ); } ); Here’s a PHP < 5.3 version of the code in case you’re getting errors. function reset_permalinks() { global $wp_rewrite; $wp_rewrite->set_permalink_structure( ‘/%year%/%monthnum%/%postname%/’ ); } add_action( ‘init’, ‘reset_permalinks’ );

Adding a div to wrap widget content after the widget title

In addition to Toscho’s answer here’s what you need for a robust solution: // if no title then add widget content wrapper to before widget add_filter( ‘dynamic_sidebar_params’, ‘check_sidebar_params’ ); function check_sidebar_params( $params ) { global $wp_registered_widgets; $settings_getter = $wp_registered_widgets[ $params[0][‘widget_id’] ][‘callback’][0]; $settings = $settings_getter->get_settings(); $settings = $settings[ $params[1][‘number’] ]; if ( $params[0][ ‘after_widget’ ] == … Read more

How can I display a menu on certain pages only?

That’s a nice option, but I agree with sri, right now it really depends on your theme. You can do a work-around through is_page(). You need to write something like this on your page.php theme file: <?php if (is_page(‘projects’)) { if ( is_active_sidebar( ‘sidebar-navigation’ )) { dynamic_sidebar( ‘sidebar-navigation’ ); } } ?> If you want … Read more

How do I add version control to my workflow?

First of all, you need to recognize that there are two workflows here: yours and your client. Your Workflow Receive PSD Code HTML/CSS Code WordPress template Deploy theme to live WordPress site Their Workflow Devise required changes and email you Write posts Upload photos The Issue Implementing version control here has absolutely nothing to do … Read more

How to store widget fields data as an array?

You have to collect multiple fields under the same name like this … name=”collect[1]” name=”collect[2]” … and adjust your widget logic to this. Here is a very simple demo widget: <?php # -*- coding: utf-8 -*- /* Plugin Name: Store Options as array */ add_action( ‘widgets_init’, array ( ‘T5_Array_Options_Widget’, ‘register’ ) ); class T5_Array_Options_Widget extends … Read more

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