Category: WordPress

  • Should I use web fonts with WordPress?

    Should I use web fonts with WordPress?

    I don’t recommend this because it slows down the display. If you really want to use it, you should upload the fonts and host it.

  • How to create a free membership site with WordPress

    How to create a free membership site with WordPress

    If you want to build a membership site for free, I think the Simple Membership plugin is a good option.

  • How to sell paid articles on WordPress

    How to sell paid articles on WordPress

    This time I will introduce a plugin that I use to sell paid articles. To use this plugin, use WooCommerce’s shop system. And since you need your readers to create an account, you need to uncheck WooCommerce –> Settings –> Accounts & Privacy –> “Allow customers to place orders even if they don’t have an account.”

    So, what plugin are you using? It’s a plugin called Pay For Post with WooCommerce. First, install WooCommerce, then install Pay For Post with WooCommerce. After creating a post, before publishing it, create a product in WooCommerce. Make it into a virtual product and publish it. After that, go back to the post and link the WooCommerce product you created with the article.

  • How to prevent WooCommerce products from being displayed when searching from the WordPress regular search widget

    How to prevent WooCommerce products from being displayed when searching from the WordPress regular search widget

    If you have WooCommerce installed in WordPress, all posts, pages, and products will be displayed when you search from the regular search widget. Today I will introduce a code that does not display the product and page when searching from the regular search widget. Put the following code in functions.php.

    /** Remove WooCommerce products and WordPress page results from search form widget */
       function mycustom_modify_search_query( $query ) {
         // Make sure this isn't the admin or is the main query
         if( is_admin() || ! $query->is_main_query() ) {
           return;
         }
         // Make sure it is not a WooCommerce product search form
         if( isset($_GET['post_type']) && ($_GET['post_type'] == 'product') ) {
           return;
         }
         if( $query->is_search() ) {
           $in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) );
           // Type of post to delete (Example: "product" and "page")
           $post_types_to_remove = array( 'product', 'page' );
           foreach( $post_types_to_remove as $post_type_to_remove ) {
             if( is_array( $in_search_post_types ) && in_array( $post_type_to_remove, $in_search_post_types ) ) {
               unset( $in_search_post_types[ $post_type_to_remove ] );
               $query->set( 'post_type', $in_search_post_types );
             }
           }
         }
       }
       add_action( 'pre_get_posts', 'mycustom_modify_search_query' );
  • Code to exclude certain categories from search results in WordPress

    Code to exclude certain categories from search results in WordPress

    When selling paid articles on WordPress, if the search term is included in the paid article, by default the paid article will also be displayed in the search results.

    (more…)
  • How to stop RSS Feed in WordPress

    How to stop RSS Feed in WordPress

    Put the following code in functions.php.

    function wpb_disable_feed() {
    wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
    }
    
    add_action('do_feed', 'wpb_disable_feed', 1);
    add_action('do_feed_rdf', 'wpb_disable_feed', 1);
    add_action('do_feed_rss', 'wpb_disable_feed', 1);
    add_action('do_feed_rss2', 'wpb_disable_feed', 1);
    add_action('do_feed_atom', 'wpb_disable_feed', 1);
    add_action('do_feed_rss2_comments', 'wpb_disable_feed', 1);
    add_action('do_feed_atom_comments', 'wpb_disable_feed', 1);
  • How to stop scaling images in WordPress

    How to stop scaling images in WordPress

    To stop the function that automatically scales images with a resolution of 2560px or higher when uploading images in WordPress, add the following to functions.php.

    //Disable Scaling Of Image
    add_filter( 'big_image_size_threshold', '__return_false' );
  • How to change the WordPress login screen

    How to change the WordPress login screen

    Put the following in functions.php. Replace “Your Logo Here” and “Your URL Here” with your own.

    function custom_login_logo() {
        echo '<style type="text/css">
            .login h1 a {
              background-image: url(https://sitecreation.genxnotes.com/wp-content/uploads/2023/04/avatar.png) ; // Your Logo Here
              background-position: center center;
    		  background-size: contain;
    	      width: 100%;
            }
        </style>';
    }
    add_action('login_head', 'custom_login_logo');
    
    function login_url(){
    return "https://sitecreation.genxnotes.com"; // Your URL Here
    }
    add_filter('login_headerurl', 'login_url');
  • Risks of paid WordPress plugins and countermeasures

    Risks of paid WordPress plugins and countermeasures

    When considering the use of paid WordPress plugins, it’s essential to understand the potential risks involved and how to mitigate them effectively. Below is a detailed overview of these risks along with actionable countermeasures.

    (more…)
  • Should I use or avoid free WordPress plugins?

    Should I use or avoid free WordPress plugins?

    When considering whether to use or avoid free WordPress plugins, it’s essential to weigh the pros and cons. Here’s a detailed look at both sides to help you make an informed decision.

    (more…)