Saturday, August 18, 2018

How to Disable WordPress Admin Bar for All Users Except Administrators

Disable Admin Bar for All Users Except for Administrators

Paste this code in your theme’s functions.php file
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}


Disable Admin Bar for All Users

If you want to disable it for all users, then simply put use this code in your theme’s functions.php file
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
  show_admin_bar(false);
}

Friday, August 17, 2018

Wordpress media library not loading images


WordPress media library not loading images or Images are not displaying the images:

Main cause of this issue is the plugin conflict, so please deactivate the plugin one by one and check that your issue resolved or not.

WordPress always update it's software to avoid or overcome issues and it is depreciating the old functions. but some of our plugin using these functions and create problem. So in that case please update the plugin if possible otherwise deactivate it .


How to open iframe external link in parent window

To open a link in the parent window inside a Iframe you can use the one of the below methods:

  1. If We wants all the link to open in the parent window then use the below tag in the header:
    <head><base target="_parent"><base></head>
     
  2. We can also use the tag target="_parent" in <a href="aboutus" target="_blank"/> tag
     
  3. We can also use javascript

    parent.document.location.href = "http://example.com";

Saturday, August 11, 2018

Wordpress pagination 404 error "/page/2" - what to do?


The problem mainly arises because permalinks set to Custom Structure /%category%/%postname%/. I understand WordPress assumes "page" is a post from the category.

That is totally normal behaviour. If you want to remove category base you will need to write some custom rewrite rules, not simple rules I must say.

Configure category base to . (dot), put this code in the functions.php of your theme, or better in a plugin, and flush the rewrite rules (code from this post in Daily Web Kit):

add_filter( 'category_rewrite_rules', 'vipx_filter_category_rewrite_rules' );
function vipx_filter_category_rewrite_rules( $rules ) {
    $categories = get_categories( array( 'hide_empty' => false ) );

    if ( is_array( $categories ) && ! empty( $categories ) ) {
        $slugs = array();
        foreach ( $categories as $category ) {
            if ( is_object( $category ) && ! is_wp_error( $category ) ) {
                if ( 0 == $category->category_parent ) {
                    $slugs[] = $category->slug;
                } else {
                    $slugs[] = trim( get_category_parents( $category->term_id, false, '/', true ), '/' );
                }
            }
        }

        if ( ! empty( $slugs ) ) {
            $rules = array();

            foreach ( $slugs as $slug ) {
                $rules[ '(' . $slug . ')/feed/(feed|rdf|rss|rss2|atom)?/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
                $rules[ '(' . $slug . ')/(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
                $rules[ '(' . $slug . ')(/page/(\d)+/?)?$' ] = 'index.php?category_name=$matches[1]&paged=$matches[3]';
            }
        }
    }
    return $rules;
}
For more details , you can check on the url https://wordpress.stackexchange.com/questions/172958/custom-permalink-structure-leads-to-be-404-on-pagination 

Saturday, May 26, 2018

Prevent images on your page from appearing in facebook web scraper

Prevent images on your page from appearing in Facebook Web Scraper

1. try to use images below size 200X200 2. if you will use the bigger image than add this image as background.

Wednesday, May 23, 2018

Wordpress - Create a Child Theme


How to Create a Child Theme
1.       Create the child theme directory, which will be placed in wp-content/themes folder. The name of your child theme directory is appended with '-child'. You will also want to make sure that there are no spaces in your child theme directory name, which may result in errors.
2.       The next step is to create your child theme's stylesheet (style.css). The stylesheet must begin with the following
/*
Theme Name: Twenty Fifteen Child Theme
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: twenty-fifteen-child
*/
                Note – Template “twentyfifteen” should be same as parent folder name. this is case sensitive. Otherwise you will get the error “the parent theme is missing. please install the x parent theme”
3.       Create a functions.php in your child theme directory. The first line of your child theme's functions.php will be an opening PHP tag (), after which you can enqueue your parent and child theme stylesheets.

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>

where parent-style In your child code, replace the instance of 'parent-style' with 'twentyfifteen-style', like so:
parent_style = 'twentyfifteen-style';

Friday, May 18, 2018

Reload Registry Without Reboot

Forces changes to the registry without requiring a complete reboot.
1. Press CTRL-ALT-DELETE to bring up the Windows task list.
2. Select Explorer and click on End Task
3. When the Shutdown screen is shown, click Cancel
4. After a few seconds an error message will show. Click on End Task.
Then Windows will reload explorer and any new registry settings.

Check SSL Protocols status on server

Check SSL Protocols status on server

please visit the below link:

https://www.ssllabs.com/ssltest/index.html

and the name of domain like domain.com, it will show the status of SSL  Protocols on server.