How to exclude parent category but show child categories?

I spent almost two months building and debugging Total Widget Control to do exactly this for all of a sites widgets. Bear with me as I strip the code out of Total Widget Control and try to make it usable for you. global $wp_query $twc_menu_item_object = $wp_query->object_id; //is the object id of the current page. … Read more

Advice: Template structure – php blocks in sidebar or someting else?

I would say to add them as template parts as in content-[name].php. For instance in page.php you could have something like: <?php while ( have_posts() ) : the_post(); ?> <?php if (is_page( ‘home’ ) ){ get_template_part( ‘content’, ‘benefits’ ); } elseif (is_page( ‘Contact’ ) ){ get_template_part( ‘content’, ‘contact’ ); } } get_template_part( ‘content’, ‘popup’ ); … Read more

How to allow admins to create a sidebar from the admin

Create a function that register sidebars, using register_sidebar, starting from an option: add_action(‘widgets_init’, ‘my_custom_sidebars’); function my_custom_sidebars() { $sidebars = get_option(‘my_theme_sidebars’); // get all the sidebars names if ( ! empty($sidebars) ) { // add a sidebar for every sidebar name foreach ( $sidebars as $sidebar ) { if ( empty($sidebar) ) continue; register_sidebar(array( ‘name’ => … Read more

How to translate month names in “Archives”

if the translation is only for the archive widget, a filter function might work (to be added to functions.php of the theme): add_filter(‘get_archives_link’, ‘translate_archive_month’); function translate_archive_month($list) { $patterns = array( ‘/January/’, ‘/February/’, ‘/March/’, ‘/April/’, ‘/May/’, ‘/June/’, ‘/July/’, ‘/August/’, ‘/September/’, ‘/October/’, ‘/November/’, ‘/December/’ ); $replacements = array( ‘jan’, ‘feb’, ‘mar’, ‘apr’, ‘may’, ‘jun’, ‘jul’, ‘aug’, ‘sep’, … Read more

Change which sidebar get_sidebar() gets from functions.php

Get sidebar is a really thin wrapper around locate_template, which just searches the current child theme and parent theme directory for the given sidebar. get_sidebar in wp-includes/general-template.php: $templates = array(); if ( isset($name) ) $templates[] = “sidebar-{$name}.php”; $templates[] = ‘sidebar.php’; // Backward compat code will be removed in a future release if (” == locate_template($templates, … Read more

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