- Easy installation and upgrade
- In-built SEO engine
- Easy theme system
- Flexibility
- Multilingual- available in more than 70 languages
- Own data- no unwanted advert on your website
- Flexibility and Easy publishing option
Category: Wordpress
How to add custom field under WordPress general settings
To add custom fields under WordPress general settings without hacking core code, use the below example. Here’s how to add custom field under WordPress general settings page.
add_filter('admin_init', 'register_my_general_settings_fields'); function register_my_general_settings_fields()
{
register_setting('general', 'custom_field', 'esc_attr');
add_settings_field('custom_field', '<label for="custom_field">'.__('Custom Field' , 'custom_field' ).'</label>' , 'general_settings_custom_fields_html', 'general');
}
function general_settings_custom_fields_html()
{
$value = get_option( 'custom_field', '' );
echo '<input type="text" id="custom_field" name="custom_field" value="' . $value . '" />';
}
Please let me know, If you have any queries or feedback.
How to add Custom Sidebars or Widget Area in WordPress
Sidebars allow you display widgets inside your theme. In this post, we will teach you the way to create sidebar and display that sidebar in your theme.
First thing you need to do is register the sidebar or widget area. So copy the below code and paste in your functions.php file. Once you registered the sidebar, It will be displayed in your Appearance => Widget screen in the backend.(WP admin).
function register_sidebar_widget() { register_sidebar( array( 'name' =>__( 'Sidebar', 'wpb'), 'id' => 'sidebar', 'description' => __( 'Appears on the static front page template', 'wpb' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'register_sidebar_widget' );
Now You need to copy and paste the below code in your template files to display the sidebar.
<?php if ( is_active_sidebar( 'sidebar' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar' ); ?> </div> <?php endif; ?>
In this example codes, we have registered and displayed the widget are in template files.
Please let me know, If you have any queries or feedback.
What are the defaults tables in WordPress?
There are 11 table in WordPress, they are
- wp_options
- wp_users
- wp_links
- wp_commentmeta
- wp_term_relationships
- wp_postmeta
- wp_posts
- wp_term_taxonomy
- wp_usermeta
- wp_terms
- wp_comments
What are the ways to install WordPress Plugins in WordPress website?
There are 3 ways to install WordPress Plugins. They are listed below.
- Search and install
- Upload and install
- FTP
How to Remove/Disable RSS feeds from WordPress?
Easy way to Remove/Disable RSS feeds from WordPress is install and activate “Remove RSS Feed” plugin.
No need to set anything. This plugin will remove/disable the RSS feeds from WordPress when you activate.
Please let me know, If you have any queries or feedback.
How to hide/change WordPress login URL without plugin?
By default, wp-login.php file having all the codes to generate login page. There are 5 steps to hide/change WordPress login URL without plugin.
- Create a new file.
- Copy the code from your wp-login.php, then paste it into your new file.
- Replace each instance of wp-login.php with the new file name. Find and replace is your friend.
- Delete the wp-login.php file.
- Login through your new URL.
Please let me know, If you have any queries or feedback.
How to get count of users having each role, as well as the count of all users?
By default WordPress having an function called count_users() to get count of users having each role, as well as the count of all users.
Check below example code for your reference.
$result = count_users(); echo 'There are ', $result['total_users'], ' total users'; foreach($result['avail_roles'] as $role => $count) echo ', ', $count, ' are ', $role, 's'; echo '.';
Please feel free to contact me if you need any further information.
How to disable email notification after password change?
To disable email notification after password change, Add the following code in your theme file or plugin files.
/* To disable email notification after password change */ add_filter( 'send_password_change_email', '__return_false' );
Please feel free to contact me if you need any further information.
How to get category ID from category name in WordPress?
By default WordPress having an function called get_cat_ID() to retrieve get category ID from category name. Please check the below sample code for how to get category ID from category name in WordPress. Replace ‘Category Name’ with your category name.
$categoryID = get_cat_ID('Category Name');
If you have any doubt, Please comment here.