Posts

how to create custom input fields inside settings general page . in wordpresss?

 functions.php /* * Add custom setting field to general settings page (Working hours section) start */ function my_custom_settings_init (){     register_setting ( 'general' , 'wrking_hours_main_text' );     register_setting ( 'general' , 'moday_friday_hours' );     register_setting ( 'general' , 'saturday_hours' );     register_setting ( 'general' , 'sunday_holiday_hours' );     // Add a section to the General Settings page     add_settings_section (         'working_hours_section' ,         'Working Hours' ,         'my_custom_section_callback' ,         'general'     );     // Add settings fields     add_settings_field (         'wrking_hours_main_text' ,         'Description Text' ,         'working_hours_description_callback' ,       ...

How to create sliders banners custom code in wordpress ?

 1) function.php /* * Add custom menu (Sliders) to admin  panel */ function slider_custom_post_type (){     register_post_type ( 'sliders' , array (         'labels' => array (             'name' => __ ( 'Sliders' ),             'singular_name' => __ ( 'sliders' )         ),         'public' => true ,         'has-archive' , true ,         'rewrite' => array ( 'slug' => 'sliders' ),         'show_in_rest' => true ,         'supports' => array ( 'title' , 'editor' , 'author' , 'thumbnail' , 'comments' , 'revisions' ),         'taxonomies' => array ( 'category' )     )); } add_action ( 'init' , 'slider_custom_post_type' ); This will create new menu in wp-admin with given fileds 2) Install advanced custom fileds plug...

How to create dynamic header menus with custom css class in wordpress ?

  1. Register Menu Locations First, you need to register the menu locations in your theme. This is typically done in the functions.php file of your theme. Add the following code to functions.php : function menu_register () {     register_nav_menus (         array (             'primary-menu' => __ ( 'Primary Menu' ),             'footer-site-map-menu' => __ ( 'Footer site map menu' ),             'footer-service-areas-menu' => __ ( 'Footer service areas menu' ),         )     ); } add_action ( 'init' , 'menu_register' ); // Add additinal class to li tag class function add_additional_class_on_li ( $classes , $item , $args , $depth ){     if ( $depth == 0 && isset ( $args -> add_li_class )){         $classes []= $args -> add_li_class ;     }     if ( isset ( $...

How to create a child theme in wordpress ?

1)Under wp-contents ->themes -> create new folder sometheme  2)under sometheme folder create style.css  add below lines /*  Theme Name:   Nadi plumbing  Theme URI:    http://example.com/my-child-theme  Description:  A custom child theme for the Twenty Twenty-One theme  Author:       Invitra  Author URI:   http://example.com  Template:     twentytwenty  Version:      1.0.0 */ 3) define functions.php  to interact between wordpress and database , define functions here  4) header.php - the of html from starting html tag to header tag  5) footer.php   a html code from footer start tag to html end tag 6) front-page.php : the content that you want to add to home page  <?php get_header (); ? > <!--/main content  --> <?php get_footer (); ? > 7)page.php :  the pages design for other pages  <?php /* Template Name: Cu...