Where do I go to edit this area? [closed]

Welcome to the site 🙂 Since you already know that the item you want to change is in framework/legacy/cranium/headers/views/global/_navbar.php then the matter of changing it is very easy and straightforward. First: Create a child theme (if you haven’t already). A child theme will allow you to change just the things you want while preserving the … Read more

Adding additional roles on registration

You check the role not for the created user, only the currently logged in user. Try this way: add_action( ‘user_register’, ‘se333727_additional_roles’ ); function se333727_additional_roles( $user_id ) { $new_user = get_user_by( ‘ID’, $user_id ); if ( in_array( ‘um_dueling-pianist’, (array)$new_user->roles ) ) { $new_user->add_role(‘pianist’); } }

use loop to return blog details

You need to re-arrange your code. <?php $post_id = 20; while($post_id <= 25) { $queried_post = get_post($post_id); $author_id = $queried_post->post_author; echo get_the_author_meta(‘display_name’, $author_id); $post_id++; } ?> Within while loop above you have $queried_post which is an object of class WP_Post. Member Variables of WP_Post can be used to display data about each post. I hope … Read more

Shortcode for Listing Users from Meta Value?

It’s a small coding mistake.. It’s not displaying anything because when there are results, the end output is always a </ul> because you’re always overwriting the $results and not appending output to the variable: $results=”<ul>”; foreach ($users as $user){ $results=”<li>” . $user->display_name . ‘</li>’; } $results=”</ul>”; So the proper code is: $results=”<ul>”; foreach ($users as … Read more

Possible to merge these two functions?

Unless I’m missing something, I would think you could just use an OR (||) operator to check if it is_tag() or is_tax(): add_action( ‘pre_get_posts’, ‘sort_conference_by_date’ ); function sort_conference_by_date( $query ) { if ( $query->is_main_query() && !is_admin() ) { if ( $query->is_tag() || $query->is_tax() ) { $query->set(‘orderby’, ‘meta_value’); $query->set(‘meta_key’, ‘start_date’); $query->set(‘order’, ‘DESC’); } } }

Redirect website domain (including all pages) to external URL after Popup message (few seconds)

“Where” somewhat depends on the theme you’re using. Here’s couple examples, If you have a custom made theme, then you can put the code in any appropriate place. For example header.php (after <head>) or footer.php. If you have child theme, then you can copy a suitable template_part file from the parent theme to the child … Read more

load CSS only for administrators on backend

This is what I use, tested and works… function wpse_admin_styles(){ $user = wp_get_current_user(); if( !empty($user) && count(array_intersect([“administrator”], (array) $user->roles ))) { wp_enqueue_style( ‘admin_css’, get_stylesheet_directory_uri() . ‘/css/admin-styles.css’, array(), filemtime( get_stylesheet_directory() . ‘/css/admin-styles.css’) ); } } add_action(‘admin_enqueue_scripts’, ‘wpse_admin_styles’);

Warning: preg_match(): No ending delimiter ‘^’ found in

I usually try to avoid using preg_match(), because I get the pattern right very rarely. Perhaps you could try using some other functions to do the validating. For example PHP’s ctype_alnum() for the name field and WP’s is_email() for the email field. Like so, if ( $_POST[‘submission_name’] == ” ) { $flag = 0; echo … Read more