Programmatically add widgets to sidebars

When I started this answer it should be just a small note. Well, I failed. Sorry! Stay with me, there is a goody hidden deep down … How WordPress widgets are stored The list of widget is stored in an option named ‘sidebars_widgets’. A var_export() may give something like the following: array ( ‘wp_inactive_widgets’ => … Read more

author list not linking to correct page

To generate a link to the author’s page/archive on your website, use get_author_posts_url with the author’s user ID. In your case: <li class=”clearfix”><?php echo get_avatar( $user->ID, ’80’ ) . ‘<a href=”‘ . get_author_posts_url( $user->ID ) . ‘”>’ . $user->display_name . ‘</a>’; ?></li>

Programmatically add widgets to sidebars

When I started this answer it should be just a small note. Well, I failed. Sorry! Stay with me, there is a goody hidden deep down … How WordPress widgets are stored The list of widget is stored in an option named ‘sidebars_widgets’. A var_export() may give something like the following: array ( ‘wp_inactive_widgets’ => … Read more

Generate sidebar depending on height of post

JavaScript is definitely the way to go. Have a look at jQuery’s height() and outerHeight() functions. outerHeight() includes margins and padding, height() doesn’t. To keep this as simple as possible I would render a fixed-height sidebar initially (from WP/PHP) where the height is a sensible estimate of your longest post and then use JavaScript to … Read more

Programmatically add widgets to sidebars

When I started this answer it should be just a small note. Well, I failed. Sorry! Stay with me, there is a goody hidden deep down … How WordPress widgets are stored The list of widget is stored in an option named ‘sidebars_widgets’. A var_export() may give something like the following: array ( ‘wp_inactive_widgets’ => … Read more

How to increase maximum number of sidebars support?

Just tried it on a test install with twenty-something sidebars, all works fine. Note that id parameter should be unique between all of them. name doesn’t have to be, but it’s nice to keep it unique as well so as to avoid confusion in the admin UI. register_sidebar( array( ‘name’ => ‘twenty-three’, ‘id’ => ‘sidebar-23’, … Read more

Default widgets assignment – isn’t working

I solved the issue using a fallback with PHP conditionals: in my sidebar.php I coded like the following: <?php if( is_active_sidebar(‘my_sidebar’) ) { ?> <div id=”secondary” class=”widget-area”> <ul class=”xoxo”> <?php dynamic_sidebar(‘my_sidebar’); ?> </ul> </div><!– #secondary .widget-area –> <?php } else { ?> <div id=”secondary” class=”widget-area”> <ul class=”xoxo”> <?php // Default Widget : Archives ?> <li … Read more

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