Showing posts with label WordPress. Show all posts
Showing posts with label WordPress. Show all posts

How to Disable the Gutenberg WordPress Editor


Learn How to Disable the Gutenberg WordPress Editor and revert to the Classic Editor. Many people are not finding the gutenberg editor useful. A lot of people tend to prefer to stick with what they already know. And gutenberg being too much complicated editor. It can get trouble to play with this editor on everyday basis. So disabling the editor does make sense. So you can revert to the classic editor in the WordPress dashboard.


Here in the below video you will see How to Disable the Gutenberg WordPress Editor.







It makes use of the plugin that allows you to disable the gutenberg editor and you get to use the classic editor. I have seen this to working and I'd recommend you try this method with the classic editor plugin. It should be good enough for you to disable the editor. And you can also use the previously most popular classic editor. It can solve your issues quickly that way. 

Do let me know if this advice worked out for you. 

Genesis Framework Code Snippets

Here's collection of Code snippets of Genesis Framework for WordPress. These code snippets are supposed to be used in functions.php of child theme. You can use these code snippets in existing official genesis themes or while making your own themes.

These code snippets helps you make changes to your layout and allows you to control how you manage the look and feel of the template. This hub will be regularly updated with the new code snippets as I use or come across on the web.

Learn HTML to WordPress Conversion.

Where to put these code snippets?

Your genesis child theme has functions.php file. Open the functions.php file from the wordpress interface or upload the functions.php via ftp to your Genesis Themes folder.

Header Code Snippets

Here are some of the code snippets that you can use to edit the genesis child theme header.
You'll find following :
  • Add Custom Background
  • Add Support for Custom Header
  • Remove Header
  • Remove Title & Description
  • Custom Header URL
  • Remove Header Right Widget Area
Add Custom Background
/** Add support for custom background */
add_custom_background();
Add Support for Custom Header
/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 100 ) );
Remove Header
/** Remove Header */
remove_action( 'genesis_header', 'genesis_do_header' );
Remove Title & Description
/** Remove Title & Description */
remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
Custom Header URL
// Customize the header URL
add_filter('genesis_seo_title', 'custom_seo_title', 10, 3);
function custom_seo_title($title, $inside, $wrap) {
$inside = sprintf( '%s', esc_attr( get_bloginfo('name') ), get_bloginfo('name') );
$title = sprintf( '<%s id="title">%s</%s>', $wrap, $inside, $wrap);
return $title;
}
Remove Header Right Widget Area
// Remove the header right widget area
unregister_sidebar( 'header-right' );

Navigation Code Snippets

You'll find the following Navigation Code Snippets.
  • Move Navigation Menu
  • Secondary Navigation Menu
  • Unregister Navigation Menus
  • Reposition Navigation
Navigation Menu
/** Move primary nav menu */
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
Secondary Navigation Menu
/** Move secondary nav menu */
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_header', 'genesis_do_subnav' );
Unregister Navigation Menus
// Unregister primary/secondary navigation menus
remove_theme_support( 'genesis-menus' );
// Unregister primary navigation menu
add_theme_support( 'genesis-menus', array( 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ) ) );
// Unregister secondary navigation menu
add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) );
Reposition Navigation
// Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
// Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_header', 'genesis_do_subnav' );

Theme Layout Code Snippets

There are some easy layout fixes for the genesis child theme.
  • Force Layout Setting
  • Register Default Layout Setting
  • Unregister Layout Settings
  • Add Structural Wraps
Register Default Layout Setting
// Register default layout setting
genesis_set_default_layout( 'content-sidebar' );
// Register default layout setting
genesis_set_default_layout( 'sidebar-content' );
// Register default layout setting
genesis_set_default_layout( 'content-sidebar-sidebar' );
// Register default layout setting
genesis_set_default_layout( 'sidebar-sidebar-content' );
// Register default layout setting
genesis_set_default_layout( 'sidebar-content-sidebar' );
// Register default layout setting
genesis_set_default_layout( 'full-width-content' );
Unregister Layout Settings
// Unregister content/sidebar layout setting
genesis_unregister_layout( 'content-sidebar' );
// Unregister sidebar/content layout setting
genesis_unregister_layout( 'sidebar-content' );
// Unregister content/sidebar/sidebar layout setting
genesis_unregister_layout( 'content-sidebar-sidebar' );
// Unregister sidebar/sidebar/content layout setting
genesis_unregister_layout( 'sidebar-sidebar-content' );
// Unregister sidebar/content/sidebar layout setting
genesis_unregister_layout( 'sidebar-content-sidebar' );
// Unregister full-width content layout setting
genesis_unregister_layout( 'full-width-content' );
Add Structural Wraps
// Add support for structural wraps
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'inner',
'footer-widgets',
'footer'
) );

Admin Management Code Snippet

Some admin level settings you can edit:
  • Color Style Options
  • Managing Settings
Managing Settings // Remove Genesis in-post SEO Settings remove_action( 'admin_menu', 'genesis_add_inpost_seo_box' ); // Remove Genesis Layout Settings remove_theme_support( 'genesis-inpost-layouts' ); // Remove Genesis menu link remove_theme_support( 'genesis-admin-menu' ); // Remove Genesis SEO Settings menu link remove_theme_support( 'genesis-seo-settings-menu' ); Color Style Options // Create color style options add_theme_support( 'genesis-style-selector', array( 'theme-blue' => __( 'Blue', 'custom-theme-text-domain' ), 'theme-green' => __( 'Green', 'custom-theme-text-domain' ), 'theme-orange' => __( 'Orange', 'custom-theme-text-domain' ), 'theme-red' => __( 'Red', 'custom-theme-text-domain' )
) );

Post Meta Code Snippets

Genesis Post Meta Code Snippets are as follows:
  • Remove Post info and Post Meta
  • Remove Edit (Post) Link
  • Add Post Image above Title
  • Custom Post Info
  • Custom Post Meta
  • Change Avatar Size
  • Remove Breadcrumbs
  • Change Read More Link
Remove Post info and Post Meta // Remove Post Info remove_action('genesis_before_post_content', 'genesis_post_info'); // Remove Post Meta remove_action('genesis_after_post_content', 'genesis_post_meta'); Remove Edit (Post) Link /** Remove Edit Link */ add_filter( 'edit_post_link', '__return_false' ); Remove default Post Image /** Remove default post image */ remove_action( 'genesis_post_content', 'genesis_do_post_image' ); Add Post Image above Title /** Add custom post image above post title */ add_action( 'genesis_before_post_content', 'generate_post_image', 5 ); function generate_post_image() { if ( is_page() || ! genesis_get_option( 'content_archive_thumbnail' ) ) return; if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) { printf( '%s', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); } }
Custom Post Info add_filter( 'genesis_post_info', 'child_post_info_filter' ); function child_post_info_filter( $post_info ) { return '[post_date] by [post_author_posts_link] at [post_time] [post_comments] [post_edit]'; } Custom Post Meta add_filter( 'genesis_post_meta', 'child_post_meta_filter' ); function child_post_meta_filter( $post_meta ) { return '[post_categories] Tagged with [post_tags]'; } Change Avatar Size add_filter( 'genesis_comment_list_args', 'child_comment_list_args' ); function child_comment_list_args( $args ) { return array( 'type' => 'comment', 'avatar_size' => 42, 'callback' => 'genesis_comment_callback' ); } Remove Breadcrumbs remove_action('genesis_before_loop', 'genesis_do_breadcrumbs'); add_action('genesis_before_content', 'genesis_do_breadcrumbs'); Change Read More Link add_filter( 'excerpt_more', 'child_read_more_link' ); add_filter( 'get_the_content_more_link', 'child_read_more_link' ); add_filter( 'the_content_more_link', 'child_read_more_link' ); function child_read_more_link() { return ''; }  

Sidebar Code Snippets

Some of the sidebar tweaks include:
  • Remove Sidebar
  • Add Custom Sidebar
  • Add Widgets in Sidebar
  • Unregister Genesis Sidebar Layout
Remove Sidebar /** Remove default sidebar */ remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); Remove Secondary and Additional Sidebar /** Remove secondary sidebar */ unregister_sidebar( 'header-right' ); unregister_sidebar( 'sidebar' ); unregister_sidebar( 'sidebar-alt' ); Add Custom Sidebar /** Add custom sidebar */ genesis_register_sidebar(array( 'name'=>'Alternative Sidebar', 'id' => 'sidebar-alternative', 'description' => 'This is an alternative sidebar', 'before_widget' => '
', 'after_widget' => "
\n", 'before_title' => '

', 'after_title' => "

\n" )); Add Widgets in Sidebar add_action( 'genesis_sidebar', 'child_do_sidebar' ); function child_do_sidebar() { if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Sidebar Name' ) ) { }} Unregister Genesis Sidebar Layout // Unregister primary sidebar unregister_sidebar( 'sidebar' ); // Unregister secondary sidebar  unregister_sidebar( 'sidebar-alt' ); 

Footer Code Snippet

Footer Code snippets are as follows:
  • Custom Footer Credits with Less information
  • Custom Footer with Disclosure and Policy Links
  • Remove Footer Widgets
  • Remove Footer
  • Reposition the Footer
/** Remove footer widgets */
remove_theme_support( 'genesis-footer-widgets', 3 );

Remove Footer

/** Remove Footer */
remove_action( 'genesis_footer', 'genesis_do_footer' );

Reposition the Footer // Reposition the footer remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 ); remove_action( 'genesis_footer', 'genesis_do_footer' ); remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 ); add_action( 'genesis_after', 'genesis_footer_markup_open', 11 ); add_action( 'genesis_after', 'genesis_do_footer', 12 ); add_action( 'genesis_after', 'genesis_footer_markup_close', 13 ); Custom Footer Credits with Less information add_filter('genesis_footer_creds_text', 'custom_footer_creds_text'); function custom_footer_creds_text($creds) { $creds = '[footer_copyright] ' . get_bloginfo('name') ; return $creds; } Custom Footer with Disclosure and Policy Links /** Footer */ remove_action('genesis_footer', 'genesis_do_footer'); add_action('genesis_footer', 'eo_custom_footer'); function eo_custom_footer() { echo ''; echo 'Copyright © '; echo '2011 - '; echo date('Y'); echo ' · Disclosure · Privacy Policy · All rights reserved'; echo '
'; }

Misc. Code Snippets

Many other misc code snippets that you can add in your child theme. Depending on your widget, layout and search box related needs, these code snippets could help you achieve the specific results.

Learn HTML to WordPress Conversion.

WordPress Security Tips

WordPress Security Checklist

As the WordPress software is regularly updated, there is always a chance of security flaw in the WordPress core. WordPress Security Tips will help you keep the blog or the website safe from the hacking and other flaws in security. In order to protect your website or blog from security issues, you can make use of the tips explained in this checklist. This is very simple checklist that can help you manage the security of the website.

Update WordPress

WordPress security updates should be taken seriously. You should update your WordPress blog regularly whenever there is an update. Some of the updates do break the backend sometimes but the fixes are made very quickly, so you have nothing to lose when you update quickly once the core is updated. Along with the Plugins, you should also update the Themes on regular basis, so that they don't contain any code that is unsafe or breaks your WordPress functionality.

WordPress Security Checklist

You can access all the security checkpoints and essential security tips in this new book - WordPress Security Checklist
Backup WordPress
You should regularly backup data whenever you update your WordPress. Other than updates that you make during core updates, consider making weekly or monthly backup points. There are plenty of cloud services that can be used to backup the WordPress core. There are plugins that you can use to upload the backup to dropbox, box, copy and similar other cloud backup services.

Secure Hosting
There are plenty of shared hosts that are charging low amount for the WordPress hosting. I suggest choosing secure wordpress host If you are serious about your web presence. Cheap hosting services are often the target of hackers so make sure you choose the hosting service carefully. Don't compromise with the Security of the hosting service, you'll save a lot of money and hassles by investing into secure hosting. WPengine offers secure hosting for the performance critical blogs and website.
Secure Passwords
It is very important that you use strong passwords for WordPress dashboard. The stronger password is what will keep the website safe from the hacker attack. The easy passwords are usually cracked by the hackers. You can use apps likes Lastpass, KeePass, 1Password and DashLane.

Don't Use "admin" as your username
The default admin username is often the target of attack by many hacking scripts. In order to save your default admin account from the script attacks, It is better to create a new user account and assign the admin role to it. This way your new admin level account will not be under attack by typical script attack that are made on "admin" account. Make sure you also choose the strong password for the new admin level account.
Limit Login Attempts to Dashboard
If you don't use the WordPress dashboard on regular basis, you can consider limiting the login attempts. Make sure you have the autologin software on your desktop if you choose to use this feature. As that will save you from getting limited during the authorization if you type the password incorrectly. There are some of the plugins that can do this job so choose a suite of plugins that can do this task along with other security hacks.
Prevent SQL Injection
Use the security measures to avoid SQL injection on your web server. Make sure you have used enough measures to stop the hackers from injecting the SQL scripts on your site. Rename the MySQL database, modify the .htaccess file and make the file permission of your files to more restrictive role. e.g. CHMOD to 755 or 644 are restrictive permissions for the files.
Use Security Plugins
Try to use popular and regularly updated Security plugins for the WordPress install. Also regularly do the security audit of these plugin to see if they are not affecting the performance of the plugins. Here are some of the plugins that you can use for making your site more secure.
  • AntiVirus
  • WP Security Scan
  • Login Security Solution
You can check out some of the WordPress Security Snippets.

Wordpress Permalinks Not Working Wamp Bitnami XAMPP LAMP

If you're using Bitnami stack or any other WAMP/LAMP/XAMPP web server and if you change the permalinks from the dashboard then URL of the blog posts don't work at all. In such case you have to use the following solution.

Find the httpd.conf file. In case of Bitnami stack on linux you can find the file in -

"lampstack/apache2/conf/httpd.conf"

In case of XAMPP/LAMP and WAMP you have to find the path of that file and open the file in the text editor. And make the following changes.

Find the following line in entire document -
AllowOverride none

And change this line to -

AllowOverride All

Make sure that there is change in entire document because that line has more than one occurance. Once you do that, restart the server or simple close the server connection and the start again. The changes should take effect immediately.

How to Download Older version of WordPress, BBPress and BuddyPress?

It is not easy to find the older version of the wordpress and it's projects from the download page. The code for the older version seems to be hosted on trac SVN of the each project. This applies to all the automattic projects like WordPress, buddypress, BBpress too.

You can go to respective trac SVN page of the project. e.g. BBPress has Trac Browser page listed here.

Click on branches folder and check specific version from the source tree. Select the folder and then look at the bottom of the page for the link " Download in other formats:  Zip Archive."




Click on the link and download the older version.

That's it. This same method applies to every wordpress and it's child projects.

WordPress Theme functions.php Code Snippet

I have compiled a list of code snippet that you can use in your functions.php. Other than the framework based shortcodes, and the tweaks, you can use official wordpress tweaks in functions.php.

Theme Support


This code snippet adds the theme support option in wordpress theme settings. You get to change some theme specific changes like blogname, colors and sub heading using theme support.

add_theme_support()

Feed Links

This code snippet enables post and comment RSS feed links to head.

add_theme_support( 'automatic-feed-links' );

Custom Header

This code snippet enables custom header support in theme.

add_theme_support( 'custom-header' );

Custom Background

This code snippet enables custom background support in theme.

add_theme_support( 'custom-background' );

Post Thumbnails

This code snippet enables Post Thumbnails support for a Theme.

add_theme_support( 'post-thumbnails' );

Post Formats

This code snippet enables Post Formats support for a Theme page.


add_post_type_support( 'page', 'post-formats' );


Register Nav Menus

By using this code snippet you can register navigation menus.

register_nav_menus();

Show Nav Menu

Show specific navigation menus using the following snippet code.

wp_nav_menu();

Register Side Bars

When you make custom sidebars, add them using the register sidebar.

register_sidebars();

Add Editor Style

Using the following code, add the editor style.

add_editor_style();

These are the functions that you can add in your functions.php while developing theme. Learn how you can make WordPress theme from HTML template. Please feel free to comment and let me know if there are additional code snippets that you can use.