Windows में Web Development Environment Set कैसे करें, Scratch,2024

| | 32 Minutes Read

हमने Part 1 जाना कि Theme Development के लिए Pre-Requirements क्या हैं और आपको इसे इस्तेमाल करने के लिए कौन से Basic Languages का ज्ञान होना चाहिए. इस Article में अब हम जानेंगे, Web Development Environment को Set कैसे करें की पूरी जानकारी.

Web Development Environment Set Kaise Kare

सबसे पहले आप अपने Computer में WampServer Start करें. उसके बाद WordPress के Themes Folder में जाऐं.(C:\wamp\www\wordpress_Folder\wp-Content\themes\ ) इस Location पर आपको 3 अलग-अलग Theme Folders और एक Index File नजर आएगी.

अब आप New Theme के लिए एक नया Folder Create करें. आप उसे कोई भी Name दे सकते हैं.

wordpress theme development tutorial in hindi

इसके बाद आपको नीचे दी गई सभी Files को Create करना होगा. ध्यान रखें यह नाम Same और इसका Extension भी Same होना चाहिए. इन सभी Files में हम एक-एक करके बाद में Codes लिखेंगे.

Style.cssIndex.php
Functions.phpHeader.php
Footer.phpSidebar.php
Content.phpComments.php
Page.phpSingle.php
Category.php404.php

Style.css: Themes के लिए सबसे पहले हम Style.css File को Edit करेंगे. इस File के अंदर आप सबसे पहले Theme Metadata को Comment में लिखते हैं. इसके बाद आप नीचे दिए Code को Copy करके Paste कर सकते हैं. हम अपनी Theme को Design करने के लिए CSS Code का इस्तेमाल करते हैं.

/*
Theme Name: Gyanians
Author: Gyanians
Description: My New WordPress Responsive Template
Version: 1.0
*/

Theme File Activate Kaise Kare

New Theme को Use करने के लिए आपको इसे सबसे पहले WordPress Dashboard में जाकर Activate करना होगा. इसलिए सबसे पहले WordPress में Login करे फिर Appearance >> Themes में जाएं. यहाँ आपको WordPress के तीनों Default Themes दिख जाएंगे. आप यहाँ से अपने Theme को Select कर सकते हैं

आप Activate Button पर Click करके इस Theme को Use कर सकते हैं. अभी आपको यह Theme Blank नजर आएगी क्योंकि इसका Index.php File अभी भी Empty है.

wordpress theme development in hindi

Theme File Kaise Banaye

Theme File बनाने के लिए आपको Index.php File को Edit करन होगा. Index.Php में Code करने के लिए आप किसी भी Editor में इसे Open कर सकते हैं. निचे दिया Code एक Static HTML Code है. हम इसे WordPress के In-Built PHP Function से Dynamic WordPress में Change करेंगे.

उसके बाद हम Index.php File को Header.php, Footer.php और Sidebar.php में इस्तेमाल कर सकते हैं.

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="author" content="">
	<title> Demo Title </title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link href="style.css" rel="stylesheet">
</head>
<body>
<div class="container" id="holder">
	
</div>	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>    
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

Change Static HTML Code to Dynamic WordPress Theme

1. Change Language Attribute:

हम जिस भी Language पर काम करना चाहते हैं, हम अपने WordPress की Settings से उसे Select कर सकते हैं. जब हम Dashboard से Language Select करते हैं, तो वो Dynamically Header.php File में Convert हो जाता है. इसके लिए आप Language_Attributes() Function का Use कर सकते हैं.

<html lang="en">

Let’s make them dynamic now with the code below:

<html <?php language_attributes(); ?>>
2. Change Meta Tag:

इसके बाद हम CharSet और Description Meta को Static से Dynamic में Change करेंगे. इसके लिए हम Bloginfo() Function का Use करेंगे. Bloginfo Function आपकी Site, User Profile और General Settings को Show कराता है.

Bloginfo(‘description’) Function आपकी Site का Tagline Show करेगा. आप आपने Dashboard के Settings >> General में इसे Set कर सकते हैं.

<meta charset="utf-8">
<meta name="description" content="">

Let’s make them dynamic now with the code below:

<meta charset="<?php bloginfo('charset' ); ?>">
<meta name="description" content="<?php bloginfo('description') ?>">
3. Change Title

अभी हमने Static Title लगा रखा है और आप  इसे भी Php Function की Help से भी Dynamic बना सकते है. लेकिन ज्यादातर Word Press Blogger Seo के लिए Yoast Seo Plugin का Use करते है तो वो आपके Title Code को Rewrite कर देती है. इसलिए आप चाहो तो Title को Static छोड़ सकते हो या नीचे Code को Copy Paste कर सकते हो.

<title> 
	<?php 
		if(is_home()) { bloginfo('name'); echo ' - ';  bloginfo('description'); }
		else { wp_title(''); echo ' - '; bloginfo('name'); }
	?>
</title>
4. Add Stylesheet

जैसा की आपको पता है की Theme के Folder में ही एक Style.css Name से Required File होती है जिसमे Theme Information और CSS Code होता है Theme को Design करने के लिए. इस Stylesheet को Add करने के लिए Bloginfo(‘stylesheet_Url’) Function Use करते है.

<link href="style.css" rel="stylesheet">

Let’s make them dynamic now with the code below:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
5. Add Header function:

Header.Php में ये सबसे Important Function है. Closing </head> Tag से Just पहले Wp_Head() Function को Add किया जाता है. Third Party Plugins और Widgets से Interact करने के लिए ये Function Use किया जाता है और इसे Add करते ही Page के Top में Admin Bar के लिए White Space आ जाता है.

<?php wp_head(); ?>

जैसे Header.Php में Wp_Head() Important Function होता है ऐसे ही Wp_Footer() Function भी Footer.Php में Important होता है. इस Function को </body> Close Tag से Just पहले लगाते है. इसे लगाने के बाद जैसे ही आप अपनी Page को Reload करेंगे तो आपको Admin Bar नजर आने लगेगा.

<?php wp_footer(); ?>
7. CheckUp Index File
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo('charset' ); ?>"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="<?php bloginfo('description') ?>">
	<title> 
		<?php 
		if(is_home()) { bloginfo('name'); echo ' - ';  bloginfo('description'); }
		else { wp_title(''); echo ' - '; bloginfo('name'); }
		?>
	</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
	<?php wp_head(); ?>
</head>
<body>
<div class="container" id="holder">
	
</div>	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>    
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<?php wp_footer(); ?>
</body>
</html>

अभी तक हमने Header और Footer का Code भी Index File में कर दिया था. अब हम Header Code जो हमे अपनी सभी Template Files में Top में चाइये उसे Header.Php File में और Footer Code जो हमे हर Template Files में Bottom में चाइये उसे Footer.Php File में Index.Php File से Cut-Paste (move) कर देंगे.

सबसे पहले आप Index.Php File में जाकर 1 Line (starting) से लेकर Opening Container Class Div तक Cut करके Header.Php में Paste कर देंगे और Closing Container Class Div से लेकर Last Line </html> तक Cut करके Footer.Php में Paste कर देंगे.

अब हम Header.Php File और Footer.Php File को Index.Php File में Php Function की Help से Add करेंगे. Header.Php Add करने लिए आपको Index File में सबसे ऊपर Get_Header() Function का और Footer.Php Add करने के लिए आपको Index.Php File में सबसे नीचे Get_Footer() Function का Use करना है.

<?php get_header(); ?>
<?php get_footer(); ?>
9. CheckUp Header File
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo('charset' ); ?>"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="<?php bloginfo('description') ?>">
	<title> 
		<?php 
		if(is_home()) { bloginfo('name'); echo ' - ';  bloginfo('description'); }
		else { wp_title(''); echo ' - '; bloginfo('name'); }
		?>
	</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
	<?php wp_head(); ?>
</head>
<body>
<div class="container" id="holder">
</div>	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>    
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<?php wp_footer(); ?>
</body>
</html>
11. CheckUp Index File
<?php get_header(); ?>


<?php get_footer(); ?>
Conclusion: WordPress Theme Development

इस Post में हमने सिखा कि आप New Theme के लिए Folder/ Files Create कैसे करें. Meta Info Add कैसे करें, Theme Activate कैसे करें. इसके बाद Header.php, Footer.php एवं Index.php File को WordPress में Add कैसे करें. इस Series के Next Part में हम Header File में Logo और Menubar Add करना सीखेंगे.

आशा करते हैं आपको Web Development Environment Set Kaise Kare और WordPress Theme Development From Scratch पोस्ट पसंद आई होगी.

अगर आपको इस Post से Related कोई सवाल या सुझाव है तो नीचे Comment करें. अगर आपको यह Post पसंद आई तो अपने दोस्तों के साथ जरुर Share करें.

Author:

Hello!! दोस्तों मेरा नाम Aryan है. मैं gyanians.com का Writer हूँ. मुझे हिंदी में Educational Blogs लिखना पसंद है. मैं इन Blogs की मदद से आप तक सभी तरह के Wordpress से जुड़ी जानकारी एवं Technical Course Exams की जानकारी पहुंचाना चाहता हूँ.मेरा आपसे निवेदन है की आप इसी तरह मेरा सहयोग देते रहें और ज़्यादा से ज़्यादा लोगों के साथ मेरे लिखे Content को शेयर करें.मैं आप सभी के लिए Latest जानकारियाँ उपलब्ध करवाता रहूँगा.

Questions Answered: (6)

Leave a Reply

Your email address will not be published. Required fields are marked *