Hide comment notification number and buttons in wp backend

you can try with this code. remove totally comment functionality in backed. Put this code in your current theme function.php file. <?php // Removes from admin menu add_action( ‘admin_menu’, ‘my_remove_admin_menus’ ); function my_remove_admin_menus() { remove_menu_page( ‘edit-comments.php’ ); } // Removes from post and pages add_action(‘init’, ‘remove_comment_support’, 100); function remove_comment_support() { remove_post_type_support( ‘post’, ‘comments’ ); remove_post_type_support( … Read more

How to remove title tag with this filter

This should have worked (the part of the sprintf at least as I don’t have access to the original code. Try give a higher number: add_filter( ‘generate_featured_image_output’ , ‘remove_image_title_archive’,100); Another solution will be removing the filter before applying yours, like this: remove_filter( ‘generate_featured_image_output’, ‘remove_image_title_archive’,10 ); Important: To remove a hook, the $function_to_remove and $priority arguments … Read more

Change username link in admin bar

Create the following directory and file. wp-content/mu-plugins/admin-bar-tweaks.php Or, you can add this to your theme’s functions.php file. In the script below, remember to set $new_url to whatever you desire. <?php // Requires PHP 5.4+. add_action( ‘admin_bar_menu’, function( $wp_admin_bar ) { $new_url=”http://example.com/custom/location”; if ( $wp_admin_bar->get_node( ‘my-account’) ) { $wp_admin_bar->add_node( [ ‘id’ => ‘my-account’, ‘href’ => $new_url, … Read more

PHP script to redirect traffic based on website accessed

I’am not absolutely sure what you mean but probably something like this may help you: if( $_SERVER[ ‘SERVER_NAME’ ] == ‘website1.com’ ): header( ‘Location: https://www.example.com/w1’ ); exit; elseif( $_SERVER[ ‘SERVER_NAME’ ] == ‘website2.com’ ): header( ‘Location: https://www.example.com/w2’ ); exit; endif;

How to always display full size image

Not a PHP solution, but below is a jQuery option. var images = $(‘.entry-content img’); images.each(function() { var src = $(this).attr(‘src’), // removes the img size off the src e.g -300×300. newsrc = src.replace(/-\d+[Xx]\d+\./,’.’); $(this).attr(‘src’,newsrc); }); You would need to remove some of the classes e.g size-thumbnail

Add ID to output only for first option

Instead of using an if check, use filter_var() so that any boolean-ish value can be passed in the shortcode attribute; e.g., yes, no, on, off, true, false, 0, 1. $no = filter_var( $no, FILTER_VALIDATE_BOOLEAN ); Now, $no is either true or false (boolean). Sorry, I see $no is actually a number. My mistake. if ( … Read more

add menu page in loop menu order

Ok it took me a while, but I think I have it. I had to use usort. I also included the code for the get_top_level_pages() method. $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’, ‘posts_per_page’ => ‘-1’)); $top_level_pages = get_page_by_title(‘Locations’); $menuArray = get_page_children( $top_level_pages->ID, $all_wp_pages ); function compareOrder($a, $b) { return $a->menu_order – $b->menu_order; … Read more