Website Tutorial Get all WordPress category names and IDs
function show_category(){ global $wpdb; $request = “SELECT $wpdb->terms.term_id, name FROM $wpdb->terms “; $request .= ” LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id “; $request .= ” WHERE $wpdb->term_taxonomy.taxonomy = ‘category’ “; $request .= ” ORDER BY term_id asc”; $categorys = $wpdb->get_results($request); foreach ($categorys as $category) { $output = ‘<span>’.$category->name.”(<em>”.$category->term_id.'</em>)</span>’; echo $output; } }
Website Tutorial WordPress completely disables the RSS function
WordPress completely disables the RSS function If you think RSS is useless, you can also disable it directly by adding the following code to the theme functions.php function: function itsme_disable_feed() { wp_die( __( ‘No feed available, please visit the <a href=”‘.%20esc_url(%20home_url(%20’/’%20)%20)%20.’”>homepage</a>!’ ) ); } add_action(‘do_feed’, ‘itsme_disable_feed’, 1); add_action(‘do_feed_rdf’, ‘itsme_disable_feed’, 1); add_action(‘do_feed_rss’, ‘itsme_disable_feed’, 1); add_action(‘do_feed_rss2’, ‘itsme_disable_feed’,…
Website Tutorial Creating a Frontend Login Form in WordPress
<?php if (!(current_user_can(‘level_0’))) { ?> <form action=”<?php echo get_option(‘home’); ?>/wp-login.php” method=”post”> <input type=”text” name=”log” id=”customer_email” value=”<?php echo wp_specialchars(stripslashes($user_login), 1) ?>” placeholder=”Email or Username*” style=”width:225px;height: 30px;” /> <input type=”password” name=”pwd” id=”customer_password” placeholder=”Password*” /> <div class=”action-btn”> <p><input type=”submit” name=”submit” value=”Sign In” class=”btn top” /></p> <p><label for=”rememberme”><input name=”rememberme” id=”rememberme” type=”checkbox” checked=”checked” value=”forever” /> remember</label> <br>New User<span style=”font-family:Arial;”>?</span> Register…
Website Tutorial How to Customize WordPress Excerpts
Switch to the directory where the theme is located, open functions.php, and add the following code: function jackyexcerpt($max_char = 200, $more_text = ‘…’, $limit_type = ‘content’) { if ($limit_type == ‘title’) { $text = get_the_title(); } else { $text = get_the_content(); } $text = apply_filters(‘the_content’, $text); $text = strip_tags(str_replace(‘]]>’, ‘]]>’, $text)); $text = trim($text); if…
Website Tutorial Remove category base from WordPress URL
Remove category base from WordPress URL Add the following code in functions.php add_action( ‘load-themes.php’, ‘no_category_base_refresh_rules’); add_action(‘created_category’, ‘no_category_base_refresh_rules’); add_action(‘edited_category’, ‘no_category_base_refresh_rules’); add_action(‘delete_category’, ‘no_category_base_refresh_rules’); function no_category_base_refresh_rules() { global $wp_rewrite; $wp_rewrite -> flush_rules(); } // register_deactivation_hook(__FILE__, ‘no_category_base_deactivate’); // function no_category_base_deactivate() { // remove_filter(‘category_rewrite_rules’, ‘no_category_base_rewrite_rules’); // We don’t want to insert our custom rules again // no_category_base_refresh_rules(); // } //…
Website Tutorial How to disable automatic updates for themes and plugins in WordPress
1: Insert the following code into the functions.php file in the root directory of the current WordPress theme: add_filter(‘pre_site_transient_update_core’, create_function(‘$a’, “return null;”)); // Close core prompts add_filter(‘pre_site_transient_update_plugins’, create_function(‘$a’, “return null;”)); // Close plugin prompts add_filter(‘pre_site_transient_update_themes’, create_function(‘$a’, “return null;”)); // Close theme prompts remove_action(‘admin_init’, ‘_maybe_update_core’); // Disable WordPress from checking for updates remove_action(‘admin_init’, ‘_maybe_update_plugins’); // Disable…
Website Tutorial Disable thumbnails in wordpress
wordpress disable thumbnails Add the following code to your theme functions.php file: // Disable automatically generated image sizes function shapeSpace_disable_image_sizes($sizes) { unset($sizes[‘thumbnail’]); // disable thumbnail size unset($sizes[‘medium’]); // disable medium size unset($sizes[‘large’]); // disable large size unset($sizes[‘medium_large’]); // disable medium-large size unset($sizes[‘1536×1536’]); // disable 2x medium-large size unset($sizes[‘2048×2048’]); // disable 2x large size return $sizes;…
Website Tutorial Build Your Own Custom WordPress Theme
Building your own custom WordPress theme can be a rewarding process. It allows you to create a unique look and functionality for your website that’s tailored to your specific needs. Here’s a step-by-step guide to help you build your own WordPress theme from scratch: ### 1. **Set Up Your Development Environment** – **Local Development**: Install…
Website Tutorial How to remove wordpress icon from website
To remove the WordPress icon (often the “Powered by WordPress” text or the WordPress logo) from your website, you’ll need to address it depending on how and where it’s being displayed. Here are some common methods: 1. Remove “Powered by WordPress” Text Using a Theme Customizer: Log in to your WordPress admin dashboard. Go to…