Removing all classes from nav_menu except current-menu-item and current-menu-parent

Sure, you can filter out all the classes but the ones you want. add_filter(‘nav_menu_css_class’, ‘discard_menu_classes’, 10, 2); function discard_menu_classes($classes, $item) { $classes = array_filter( $classes, create_function( ‘$class’, ‘return in_array( $class, array( “current-menu-item”, “current-menu-parent” ) );’ ) ); return array_merge( $classes, (array)get_post_meta( $item->ID, ‘_menu_item_classes’, true ) ); }

How to Auto Approve Comments on a Specific Page?

Considering that in Settings > Discussion you have this options checked: The first is comment_moderation and the second comment_whitelist. Then, it is possible to selectively disable them using the filter pre_option_(option-name), as follows: add_filter( ‘pre_option_comment_moderation’, ‘wpse_72990_auto_aprove_selective’ ); add_filter( ‘pre_option_comment_whitelist’, ‘wpse_72990_auto_aprove_selective’ ); function wpse_72990_auto_aprove_selective( $option ) { global $post; if( $post->ID == 2 ) return 0; … Read more

Use of undefined constant FS_CHMOD_DIR – assumed ‘FS_CHMOD_DIR’

It’s really quite simple. The theme author is using a constant that you can put in wp-config.php, but because you don’t use that constant, and the author never checks if it’s actually defined, the code throws a PHP warning https://codex.wordpress.org/Editing_wp-config.php#Override_of_default_file_permissions Override of default file permissions The FS_CHMOD_DIR and FS_CHMOD_FILE define statements allow override of default … Read more

How to get the name and description of a sidebar in theme?

You can use the $wp_registered_sidebars global variable. Like this: global $wp_registered_sidebars; if( is_active_sidebar( ‘activity_calendar_en’ ) ): esc_html_e( $wp_registered_sidebars[‘activity_calendar_en’][‘name’] ); dynamic_sidebar( ‘activity_calendar_en’ ); endif; If you check the WordPress core for is_registered_sidebar function, you’ll see that it’s using this global variable too: function is_registered_sidebar( $sidebar_id ) { global $wp_registered_sidebars; return isset( $wp_registered_sidebars[ $sidebar_id ] ); } … Read more

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