How to display multiple custom columns in the wp-admin users.php?

hummm… do you mean something like this : function mysite_column_company( $defaults ) { $defaults[‘mysite-usercolumn-company’] = __(‘Company’, ‘user-column’); $defaults[‘mysite-usercolumn-otherfield1’] = __(‘Other field 1’, ‘user-column’); $defaults[‘mysite-usercolumn-otherfield2’] = __(‘Other field 2’, ‘user-column’); return $defaults; } function mysite_custom_column_company($value, $column_name, $id) { if( $column_name == ‘mysite-usercolumn-company’ ) { return get_the_author_meta( ‘company’, $id ); } elseif( $column_name == ‘mysite-usercolumn-otherfield1’ ) { … Read more

Shortcode with custom content attribute?

The second parameter of your shortcode function is the content. So rewrite the function: function shortcode_call_to_action( $attributes = NULL, $content=”” ) { $stylesheetdir = get_bloginfo(‘stylesheet_directory’); if ( ” === $content ) { // use a default text if there is no content $content=”default text”; } return “<div id=’call_to_action’> <img src=”https://wordpress.stackexchange.com/questions/58438/$stylesheetdir/images/call_to_action.jpg” alt=”” /> <p>$content</p>”; } If … Read more

Dynamically Register Sidebars For Each Top Level Page

try this code for creating unique sidebar for each parent page you can use $page->post_name(page slug) or $page->ID(page id) as sidebar id if ( function_exists(‘register_sidebar’) ){ /*extract all parent pages */ $topLevel = get_pages(array( ‘sort_column’ => ‘post_date’, ‘hierarchical’ => 0, ‘parent’ => 0 )); foreach($topLevel as $page){ /* register sidebar for each parent page */ … Read more

Add inline css to theme

According to Codex, this function accepts 2 arguments: <?php wp_add_inline_style( $handle, $data ); ?> Take a look at this example: function my_inline_css() { wp_enqueue_style( ‘custom-style’, get_template_directory_uri() . ‘/css/custom_script.css’ ); $btn_color = esc_attr( get_theme_mod( ‘my-custom-color’ ) ); $custom_css = ” .btn-default{ background-color: {$btn_color}; }”; wp_add_inline_style( ‘custom-style’, $my_custom_css ); } add_action( ‘wp_enqueue_scripts’, ‘my_inline_css’ ); You should have … Read more

Dynamically Override Fancy Title

The original function ends with this line: return apply_filters( ‘presscore_get_page_title’, $title ); That’s your cue. You can build a filter that completely overrules the $title generated by that function. Like this: add_filter (‘presscore_get_page_title’,’wpse263380_presscore_get_page_title’,10,1); function wpse263380_presscore_get_page_title ( $title ) { $title=”My awesome title”; return $title; }

Child theme – copied some files from parent to child website still uses parent files

Try to override the parent theme functions instead of creating your child theme header-functions.php file. Here is a reference on how it can be done : https://www.mhthemes.com/support/overriding-parent-theme-functions-child-theme-tutorial/ Check if the parent theme header-functions.php file is implementing pluggable functions. Then you can override them in your functions.php file.