Php custom query function assistance
Php custom query function assistance
Php custom query function assistance
@Martin There are a few “Coming Soon” themes available on The WordPress.org theme repository. One of them is Ready to Launch . My recommendation is to use one of the “Coming Soon” plugins instead. Why Use a Plugin? The advantage to using a plugin is that it allows you to work on the site while … Read more
This is how I’ve interpreted from the wordpress docs at least. Originally these settings were made with add_setting and it is where the capability was originally set. Fortunately, we can use get_setting to change that value. It seems to work very well for your case. function wpseo_206907_add_back_customizer_controls_for_not_admins( $wp_customize ) { $wp_customize->get_setting( ‘blogname’ )->capability = ‘edit_theme_options’; … Read more
The pre_get_comments hook Note that the single post’s comments are fetched with get_comments(), within the comment_template() function. The get_comments() function is just a WP_Comment_Query object wrapper, so we can restrict the comment query with the pre_get_comments hook. Example #1 Here’s a simple user_id restriction example: ! is_admin() && add_action( ‘pre_get_comments’, function( \WP_Comment_Query $q ) { … Read more
May be you can try this: add_filter(‘manage_edit-movie_columns’, ‘custom_add_new_columns’); function custom_add_new_columns( $columns ){ $columns[‘author_email’] = ‘Email’; return $columns; } add_action(‘manage_movie_posts_custom_column’, ‘custom_manage_new_columns’, 10, 2); function custom_manage_new_columns( $column_name, $id ){ if (‘author_email’==$column_name){ $current_item = get_post($id); $author_id = $current_item->post_author; $author_email = get_the_author_meta( ‘user_email’, $author_id); echo ‘<a href=”https://wordpress.stackexchange.com/questions/158706/mailto:”.$author_email.'”>’.$author_email.'</a>’; } } Here, I have used custom post type movie. You need … Read more
I had the same problem and found out the php-gd library wasn’t installed on my server. Installed it with yum install php-gd restarted and it worked like a charm!
My current solution is to create a directory outside the child theme that includes the CSS, JS, and php files for customizations This is a plugin, a folder containing PHP/JS/CSS, with a comment at the top of one of the PHP files that has /** Plugin Name: XYZ at the top of the file. <?php … Read more
If I understand you well, you can do that with add_rewrite_rule(); function to map the url to specific query variables. https://codex.wordpress.org/Rewrite_API/add_rewrite_rule function myfunc_rewrite_rules() { add_rewrite_rule(‘user/?([^/]*)’, ‘index.php?pagename=user&username=$matches[1]’, ‘top’); } function myfunc_username_query_vars($vars) { $vars[] = ‘username’; return $vars; } add_action(‘init’, ‘myfunc_rewrite_rules’); //add query vars (username) to wordpress add_filter(‘query_vars’, ‘myfunc_username_query_vars’); function myfunc_display() { $userpage = get_query_var(‘pagename’); $username = … Read more
Your control is named custom_num but your setting is named my_custom_num. Modify your setting’s sanitize function to use the former: $input_attrs = $setting->manager->get_control( ‘custom_num’ )->input_attrs; See also the Customize Input Validity Constraints plugin, where you can see how to obtain the control for a given setting without having to hard-code it: $controls = array(); foreach … Read more
I can’t tell you what you’re doing wrong with your includes and such, but your method of extending the class is basically correct. However, the most likely scenario that I can see is that your add_action is basically executing in the wrong place. Also, you’re doing-it-wrong by allowing the original action to stand instead of … Read more