admin

Website Tutorial

WordPress-How to show single post content in front-end?

WordPress-How to show single post content in front-end? <?php if(have_posts()) : while (have_posts()) : the_post(); the_title(); echo ‘<div class=”entry-content”>’; the_content(); if(get_post_meta($post->ID, ‘key-name’, true)){ echo get_post_meta($post->ID, ‘key-name’, true); } echo ‘</div>’; endwhile; endif; ?>
Website Tutorial

WordPress Gravatar avatar cached locally

In order to improve the user experience, I thought of caching the commenter’s avatar locally. Most of the avatar files are in png format. I tried to delete all cached avatars and re-cache them. After refreshing, the avatars can be...
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 =...
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...
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...
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 =...
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’);...
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...
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...