How to add custom post type thumbnail in WordPress

1. Add code in finctions.php file. add_theme_support( ‘post-thumbnails’, array( ‘post’, ‘page’, ‘movie’, ‘product’, ‘artist’); 2. Then add Custom Post Type add_action( ‘init’, ‘create_post_type’ ); function create_post_type() { register_post_type( ‘artist’, array( ‘labels’ => array( ‘name’ => __( ‘Artists’ ), ‘singular_name’ => __( ‘Artist’ ) ), ‘public’ => true, ‘supports’ => array(

Read More

How to create meta boxes

How to create meta boxes in WordPress First, copy the following code in functions.php file, that will take you two fields – phone and email /********************************************************************************************************* * Mete box Phone **********************************************************************************************************/ function myplugin_add_meta_box() { $screens = array( ‘post’, ‘page’ ); foreach ( $screens as $screen ) { add_meta_box( ‘myplugin_sectionid’, __(

Read More

How to add styles in WordPress admin

Copy the code into functions.php file add_action(‘admin_head’, ‘my_custom_fonts’); function my_custom_fonts() { echo ‘<style> #wpcontent { webkit-box-shadow: inset 0px 17px 56px -13px rgba(91,91,91,1); -moz-box-shadow: inset 0px 17px 56px -13px rgba(91,91,91,1); box-shadow: inset 0px 17px 56px -13px rgba(91,91,91,1); } .wrap input, .wrap textarea { background: #23282d; } </style>’; }

How to create js slider

1. HTML code <ul id=”slidesimg”> <li class=”slidimg” style=”opacity:0.9;”> <img src=”flag_en.png” alt=”” /> </li> <li class=”slidimg” > <img src=”flag_fr.png” alt=”” /> </li> <li class=”slidimg”> <img src=”flag_bg.png” alt=”” /> </li> <li class=”slidimg”> <img src=”flag_fr.png” alt=”” /> </li> <li class=”slidimg”> <img src=”flag_bg.png” alt=”” /> </li> </ul>   2. PHP code <script> function hide(element,

Read More

How to add back to top button in WordPress

1. Copy the code below into <head> <script src=”http://code.jquery.com/jquery-1.11.2.min.js”></script>   2 Then create a new file top.js . Put the following code and save it in the same folder.   $(document).ready(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $(‘.scrollup’).fadeIn(); } else { $(‘.scrollup’).fadeOut(); } }); >$(‘.back-to-top-link’).click(function ()

Read More

Upload Logo into Customize

How to Upload Logo into Customize 1. Add code below into functions.php file function upload_logo ($wp_customize) { $wp_customize->add_section(‘section’, array( ‘title’ => __(‘Upload Logo’, ‘text-dom’), // Your photo should be sized – max height 65px! ‘type’ => ‘option’, ‘description’ => ‘Your photo should be sized – max height 65px!’ )); $wp_customize->add_setting(‘logo_setting’,

Read More

How to add read more button in WordPress

1. Add code below into functions.php file function new_excerpt_more( $more ) { return ‘ <a class=”read-more” href=”‘. get_permalink( get_the_ID() ) . ‘”>’ . __(‘Read More’, ‘text-domain’) . ‘</a>’; } add_filter( ‘excerpt_more’, ‘new_excerpt_more’ );         2. Then add into categories.php following code.   <?php the_excerpt(); ?>