Contact Form 7 Redirect

add_action( 'wp_footer', 'mycustom_wp_footer' );
 
function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
    if ( '4423' == event.detail.contactFormId ) {
        location = 'https://secova.com/thank-you-demo';
    }
    if ( '4513' == event.detail.contactFormId ) {
        location = 'https://secova.com/thank-you-contact';
    }
}, false );
</script>
<?php
}

Change the ID of your contact from 7 with the id mentioned here. You can use as many forms as you want.

WordPress search form

<form method="get" action="<?php echo home_url(); ?>/">
    <input name="s" type="text" placeholder="Type your keywords">                         
    <input type="submit" value="Search">
</form>

 

Leverage browser caching & Enable Compression

Copy the code snippets and paste it inside your .htaccess file.

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
 
# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  </filesmatch>
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  </filesmatch>
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  </filesmatch>
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"
  </filesmatch>
</IfModule>

 

Register widget in WordPress

function my_custom_theme_widgets() {
    register_sidebar( array(
        'name' => 'My Widget',
        'id' => 'widget_id',
        'before_widget' => '<div class="widget_div">',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ) );
}
add_action('widgets_init', 'my_custom_theme_widgets');

 

You can call widget via below:

<?php dynamic_sidebar('widget_id'); ?>

 

Register custom post & custom taxonomy in WordPress

Register custom post type

add_action( 'init', 'my_theme_custom_post' );
function my_theme_custom_post() {
    register_post_type( 'cpt',
        array(
            'labels' => array(
                'name' => __( 'CPTs' ),
                'singular_name' => __( 'CPT' )
            ),
            'supports' => array('title', 'editor', 'custom-fields', 'thumbnail', 'page-attributes'),
            'public' => true
        )
    );
}

 

Register custom taxonomy

function my_theme_custom_post_taxonomy() {
    register_taxonomy(
        'cpt_cat',  
        'cpt',                  
        array(
            'hierarchical'          => true,
            'label'                 => 'CPT Category',  
            'query_var'             => true,
            'show_admin_column'     => true,
            'rewrite'               => array(
                'slug'              => 'cpt-category', 
                'with_front'    => true 
                )
            )
    );
}
add_action( 'init', 'my_theme_custom_post_taxonomy');

 

WP Plugin QuickStart Pack

//Plugin information
/*
Plugin Name: Your plugin Name
Plugin URI: http://example.com/pluginsurl
Description: Given your plugin description here. 
Author: Author Name
Version: 1.0
Author URI: http://example.com/
*/
//The latest jquery need to use every plugin
function wp_latest_jquery() {
    wp_enqueue_script('jquery');
}
add_action('init', 'wp_latest_jquery');
 
// Call any external file js or css
function plugin_function_name() {
    wp_enqueue_script( 'anyname-js', plugins_url( '/js/needed_jquery.js', __FILE__ ), array('jquery'), 1.0, false);
    wp_enqueue_style( 'anyname-css', plugins_url( '/css/needed_style.css', __FILE__ ));
}
 
add_action('init','plugin_function_name');
//Internal css or js given here
function another_plugin_function_name () {?>
    <script type="text/javascript">
        jQuery(document).ready(function(){
            jQuery('').ticker();
        });     
    </script>
    <style type="text/css">
    //Style here
    </style>
<?php
}
add_action('wp_head','another_plugin_function_name');
 
//Custom menu customization 
function plugin_menu_function_name() {
    add_menu_page('Plugin option panel', 'Plugin Options', 'manage_options', 'plugin-tickr-option', 'extra_option_function', plugins_url( '/images/your.png', __FILE__  ), 6 );
    add_options_page('Plugin option panel', 'Plugin Options', 'manage_options', 'plugin-tickr-option', 'extra_option_function');
}
add_action('admin_menu', 'plugin_menu_function_name');
 
function extra_option_function() {?>
    <div class="wrap">
        <h2>Plugin Option</h2>
        //here design your option page  
    </div>
     
<?php
}