Codex Topic: WordPress

  • Hiding Product Counts in The Category View

    Hiding Product Counts in The Category View   add_filter( ‘woocommerce_subcategory_count_html’, ‘woo_remove_category_products_count’ ); function woo_remove_category_products_count() { return; }  

  • Replace “Out of Stock” Word with “Sold” or Anything

    Replace “Out of Stock” Word with “Sold” or Anything   add_filter(‘woocommerce_get_availability’, ‘availability_filter_func’); function availability_filter_func($availability) { $availability[‘availability’] = str_ireplace(‘Out of stock’, ‘Sold’, $availability[‘availability’]); return $availability; }  

  • Changing Elementor Empty Placeholder Image Picture

    The Elementor image widget and media-based controls display a placeholder image, unless the user selects a specific image from the media library. By default, Elementor uses the default image located in Elementor’s plugin assets folder. However, you can replace this default image with a custom one.   function custom_elementor_placeholder_image() { return ‘https://developers.elementor.com/path/to/placeholder.png’; } add_filter( ‘elementor/utils/get_placeholder_image_src’,…

  • Making Custom Hooks and Filters With Elementor

    Elementor is awesome but sometimes it’s not enough. It is easy to solve Elementor problems with other Elementor addons but that just creates more complexity and cost.  🙂 Sooooo we use these simple hooks and filters to create our own solutions.   Elementor PHP Hook List -> PHP Hooks | Elementor Developers Some Examples ->…

  • Creating Conditions and Logic For Any Sections, Visibility Logic for Elementor

    On elementor we dont really have a logic system for sections or widgets. Yes we can make templates with Pro and create template parts that shows on some parts or in some conditions but not in the sections or small parts of the design itself. You can make a guest menu but you can not…

  • Customizer Register WordPress Theme Setting Simple

    Very simple example…     function sinan_customizer_register($wp_customize){ $wp_customize->add_section( ‘section_name’, array( ‘title’ => ‘Text Title’, ‘description’ => ‘Text descripotion sometin hee’ ) ); $wp_customize->add_setting( ‘setting_name’, array( ‘type’ => ‘theme_mod’, ‘default’ => ‘default text here’, ‘sanitize_callback’ => ‘esc_attr’ ) ); $wp_customize->add_control( ‘control_name’, array( ‘label’ => ‘Text Label ‘, ‘description’ => ‘Text descripotion sometin hee’, ‘section’ => ‘section_name’,…

  • WordPress Register Post Type

    Creating a new post type is really easy you don’t need plugins to do it.   Just add this post type to your theme functions.php file and that’s it. You will have Listing named a new post type. function register_listing() { $args = array( ‘public’ => true, ‘label’ => ‘Listing’, ‘menu_icon’ => ‘dashicons-book’, ‘has_archive’ =>…

  • PHP Check If Elementor is Used in The Page or Post

    PHP Check If Elementor is Used in The Page or Post   With this 2 php controls you can check if the page is edited with elementor or the page is_elementor_page so you can do something with it.   if ( Elementor\Plugin::instance()->db->is_built_with_elementor( get_the_ID()) ) { //page is build with elementor } // other solution or…

  • WordPress Create User and Add Role, Lost Password Cant Login

    If you cannot log in to your site, you cant reset your password and you have your FTP connection this may be a good solution for you. Just add this code to your themes functions.php and reload your website ones. This will create an administrator role user. $userdata = array( ‘user_login’ => ‘username’, ‘user_mail’ =>…

  • How to Install Redis on Ubuntu Linux, WordPress Object Cache Redis

    My favorite caching solution lately is Redis. It is crazy efficient and fast. I am using Redis on Ubuntu 20.04 with PHP 7.4.    It works with WordPress like candy…     I use Ubuntu so in Ubuntu SSH or any other Debian distro really just uses these commands;   First apt install redis-server   then…