Custom Theme Development in WordPress | वर्डप्रेस मध्ये स्वतःची थिम कशी बनवायची

Custom Theme Development in WordPress:- नमस्कार मित्रानो वर्डप्रेस मध्ये स्वतःची थिम कशी बनवायची हे आज आपण बघणार आहोत, तर मित्रानो ज्यांना प्रोग्रामिंग आणि design बद्दल माहिती असेल, ते हे सहज पण थिम बनवू शकता, ज्यांना माहित नसेल त्यांनी पूर्ण पणे स्टेप्स follow करा आपल्याला कस्टम थिम बनवता येईल, तर चला जाणून घेऊ या कस्टम थिम कशी बनवायची सोप्या पदतीने.

Custom Theme Development in WordPress

Custom Theme Development in WordPress Explain in Marathi

१.स्टेप:- वर्डप्रेस च्या file डाउनलोड केल्यानंतर आपल्या समोर नावच फोल्डर दिसेल त्यावर क्लिक करून आपण थिम नावाच्या फोल्डर मध्ये या.

step1-wordpress

२.स्टेप:- थिम या नावाच्या फोल्डर वर क्लिक केल्यावर आपल्या समोर काही default इन्स्टॉल केलेल्या themes दिसतील.

step2

३.स्टेप:-  थिम वर क्लिक केल्यावर आपल्याला एक blank फोल्डर बनवावे लागेल त्यामध्ये आपल्या कस्टम थिम चे files बनावे लागतील. त्या मध्ये आपल्याला सर्वात प्रथम खाली दिलेल्या फाइल्स बनवून घ्या

  • index.php
  • header.php
  • footer.php
  • functions.php
  • single.php
  • search.php
  • style.css
  • screenshot.png

4.स्टेप:- त्यानंतर आपण या style.css मध्ये आपल्याला खाली दिलेला code टाकायचा त्या मध्ये आपल्या थिम च नाव थिम चा url आणि description, आणि author च नाव , version टाका  

/*!
Theme Name: customtheme
Theme URI: https://www.customtheme.com
Author: estartupidea
Author URI: http://estartupidea.com
Description: women's kurtis online
Version: 1.0.0
*/

५.स्टेप:- व त्यानंतर header.php आपण या फाईल मध्ये खाली दिलेला code टाका, आपले सर्व फाईल हे एका फाईल शी जोडलेले असता ते म्हणजे index.php

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
  <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="https://gmpg.org/xfn/11">
    <?php wp_head(); ?>
  </head>
<body <?php body_class(); ?>>

६.स्टेप:- त्या नंतर या फाईल footer.php मध्ये खाली दिलेला code टाका आपले header.php आणि footer.php हे दोन्ही फाईल सर्व page सारखं राहतील.

<?php wp_footer(); ?>
</body>
</html>

या नंतर आपल्या या index.php फाईल मध्ये खाली दिलेला code टाकावा लागेल या मध्ये आपण टाकलेले पोस्ट येते दिसतील

<?php
get_header();
?>
<?php

if ( have_posts() ) :
	while ( have_posts() ) : the_post(); ?>

        <h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
		<?php the_content() ?>
	
	<?php endwhile;

else :
	echo '<p>There are no posts!</p>';

endif;

?>
<?php get_footer();?>

७ .स्टेप:- त्या नंतर आपल्या design आणि post आणि आपल्या थिम manage करण्यासाठी आपल्या functions.php हि फाईल बनवावी लागेल.

<?php
/**
 * Enqueue scripts and styles.
 */
function customtheme_scripts() {
	wp_enqueue_style( 'customtheme-style', get_stylesheet_uri() );
	}
add_action( 'wp_enqueue_scripts', 'customtheme_scripts' );
function theme_slug_setup() {
    add_theme_support( 'title-tag');
}
add_action('after_setup_theme', 'theme_slug_setup');
/**
 * Implement the Custom Header feature.
 */
function customtheme_custom_header_setup() {
	add_theme_support( 'custom-header', apply_filters( 'customtheme_custom_header_args', array(
		'default-image'          => '',
		'default-text-color'     => '000000',
		'width'                  => 1000,
		'height'                 => 250,
		'flex-height'            => true,
		
	) ) );
}
add_action('after_setup_theme', 'customtheme_custom_header_setup'); 

// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'navbar' => esc_html__( 'Primary', 'header' ),
	) );
	
// Image size for single posts
add_theme_support( 'post-thumbnails' );

// Filter except length to 35 words.
// tn custom excerpt length
function tn_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'tn_custom_excerpt_length', 999 );

// Sidebar widget
function seo_widgets_init() {
	register_sidebar( array(
		'name'          => esc_html__( 'Sidebar', 'customtheme' ),
		'id'            => 'sidebar-content',
		'description'   => esc_html__( 'Add widgets here.', 'customtheme' ),
		'before_widget' => '<section id="%1$s" class="widget %2$s">',
		'after_widget'  => '</section>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );
}
add_action( 'widgets_init', 'seo_widgets_init' );

कस्टम थिम का बनवायची

कस्टम थिम बनवायचे काही फायदे आहे एक म्हणजे थिम लवकरात लवकर ओपन होते आपला ब्लॉग हा लवकर उघडतो आपल्या ब्लॉग ची स्पीड वाढते. त्या मुळे आपल्या ब्लॉग rank होण्यास मदत मिळते, कमी code मध्ये बनलेली थिम चांगली असते, कारण आपण आपल्या गरजे नुसार त्यास design करू शकता.

You may also like...

close