Tiếng Việt

WordPress Simplified: Small Changes, Big Impact

cat.png

Author

Phước Hữu

03/05/2023

Share

wordpress.png

WordPress Simplified: Small Changes, Big Impact

1. Remember to frequently click on "Save Changes" in Permalink Settings

Here is the code snippet to create a post-type called product:

<?php
add_action('init', 'create_product_type');

function create_product_type()
{
  $labels = array(
    'name'          => _x('Products', 'post type general name'),
    'singular_name' => _x('Product', 'post type singular name'),
    'menu_name'     => 'Products',
    'all_items' =>  __('All products'),
  );

  $rewrite = array(
    'slug'          => 'product'
  );

  $args = array(
    'labels'        => $labels,
    'description'   => 'Holds our custom product items',
    'public'        => true,
    'menu_position' => 2,
    'supports'      => array('title', 'editor', 'thumbnail'),
    'has_archive'   => true,
    'rewrite'       => $rewrite,
  );

  register_post_type('product', $args);
}

Here is an example of a single-product.php file to display the detailed information of a product in the product post type.

<?php
<h1><?php echo the_title() ?></h1>

If you do not click on "Save Changes" in Permalink Settings, the page will usually display a 404.php error, for example:


 

And after you click 'Save Changes' in Permalink Settings:

 

 

Then the result will be
 

2. Regularly update your plugins..

Installation and updating errors with plugins/themes are some of the common issues that WordPress users often encounter. This can happen when the version of the plugin or theme is not compatible with your current WordPress version. When faced with this error, you may have difficulty installing or updating plugins or themes. This can cause problems on your website, affect user experience, and may lead to the loss of important data.

To solve this problem, you should always choose plugins and themes from reputable developers and update them regularly. If you encounter issues with the current version of the plugin or theme, check if there is a newer version available. If there is, update it immediately to minimize the risk of errors.

If you are unable to update your plugins or themes for any reason, seek help from the WordPress community or WordPress experts to resolve the issue. This helps avoid problems on your website and ensures that your website operates smoothly and efficiently.

 

3. Suggested plugins that I often use for you


The following plugins are the ones that I often use when working with WordPress.

Index of /wp-content/plugins/advanced-custom-fields/assets/images  All-In-One Security (AIOS) – Security and Firewall – WordPress plugin |  WordPress.org  Contact Form 7 – WordPress plugin | WordPress.org

  • The Advanced Custom Fields plugin helps me create custom fields for site content management. 
  • The All In One WP Security plugin enhances the security of my site by adding features like strong password checks, malicious IP address blocking, and protection of sensitive files. 
  • The Contact form 7 plugin allows me to create contact forms so that customers can contact me.
  • The SVG Support plugin helps me upload SVG vector image files for use on my website. 
  • The Yoast Duplicate Post plugin makes it easy for me to duplicate posts for reuse without having to rewrite them from scratch. I strongly believe in these plugins and use them frequently in my projects.

4. Pay attention to the security of your website

WordPress is one of the most popular platforms for creating and managing websites. 

However, because of this popularity, WordPress has become a prime target for hacker attacks. This poses a security problem for WordPress.  

To protect your WordPress site from attacks, there are some important security measures that you should take. First, you should use a strong password and change it periodically. We recommend using a WordPress security plugin to enhance your security, including plugins like All In One WP Security and Wordfence.  You should also regularly update WordPress and your plugins to ensure that you have the latest version with security flaws corrected. In addition, you should also back up your website regularly to ensure that you can recover your website should any security issues occur. With the right security measures in place, you can keep your WordPress site secure and avoid hacker attacks.

Share

Contact Us