Blank child theme – functions.php problem

I’ve created a child theme, and moved all the modifications I had in the parent theme functions.php into the child theme’s functions.php Don’t move all the functions from the parent theme into the child theme, just add the modifications to the child theme and leave the parent functions.php as it came with the theme. You … Read more

Register a widget area when a theme option has been saved?

In functions.php write this code function my_optionally_widgets() { $option = get_options(‘wantwidget’); if($option == ‘yes’) { register_widget(‘mywidget’); /* add other widgets for registration here */ } } add_action(‘widgets_init’, ‘my_optionally_widgets’); function my_optionally_sidebars() { $option = get_options(‘wantsidebar’); if($option == ‘yes’) { register_sidebar($args); /* add other sidebars for registration here */ } } add_action(‘init’, ‘my_optionally_sidebars’); Remember that Widget Areas … Read more

Add Function For Instances of Custom Text in Multiple Category IDs to display in post content

This doesn’t actually look like a WordPress problem, but rather a lack of PHP skills unfortunately. Your problem lies in this piece of code $custom_category_text=”<p> ” . $office[$office_random[0]] . ‘ ‘ . $office1[$office1_random[0]] . ‘</p>’; // Category ID = 1 if (in_category(‘1’)) { $content = $content . $custom_category_text; } return $content; $custom_category_text=”<p> ” . $home[$home_random[0]] … Read more

Function not recognizing page id?

missing “else” in the 3rd elseif. <?php /* Which logo do we use? */ if (is_tree(’33’) ) { // if is conway $logoClass=”logo-conway “; $link = get_bloginfo(‘url’) . ‘/conway’; } elseif (is_tree(35) ) { // if is cullowhee $logoClass=”logo-cullowhee “; $link = get_bloginfo(‘url’) . ‘/cullowhee’; } elseif (is_tree(31) ) { // if is Johnson City … Read more

Function to get the name in database table from the comma separated string

Not tested but this should work: add_action(‘manage_pages_custom_column’, ‘display_page_custom_cols’, 10, 2); function display_page_custom_cols($col_name, $post_id) { global $wpdb; $user_group = $wpdb->get_results(“SELECT * From custom_user_group”,OBJECT_K); if (‘user_group’ == $col_name) { $pages = explode(‘,’,get_post($post_id)); $output = array(); foreach ($pages as $page ) { $output[] = $user_group[$page]->GroupName; } echo implode(‘,’,$output); } }