කොහොමද දුවල පුතාල . උබල දන්නණවද එකක් Wordpress Theme හදන හැටි? . දන් නැත්තම් එන්න ඉගෙන ගන්න . මෙක මහලොකු දෙයක් නෙමේ . ඒත් හොද තීම් එකක් හදන්නනම් හොද creative කෙනෙක් වෙන්න ඕනෙ . මුලින්ම මේව ගැන පොඩි knolodge එකක් තියෙන්නම ඕනෙ .
- HTML
- CSS
- PHP ( theme ekak hadanna onema na )
ඔය ටික දන්න කාටත් තීම් එකක් හදාගන්න පුලුණන් . wordpress theme සම්මත structure එකක් තියෙනව . සරල wordpress theme එකක පහල ලිස්ත් එක තියෙන ෆයිල් අඩන්ගු වෙනවා .
- Header.php
- Index.php
- Style.css
- Sidebar.php
- Footer.php
ඔන්න ඔච්චරයි සරල theme එහෙක තියෙන්නෙ
.jpg)
දැන් බලමු එක එක ෆයිස් කොහොමද කියල .
Header.php
Code:
<html>
<head>
<title>Tutorial theme</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>HEADER</h1>
</div>
PHP Code:
<?php bloginfo('stylesheet_url'); ?>
ඔහොම තමයි style.css ලින්ක් කරගන්නෙ.
PHP Code:
<?php bloginfo('stylesheet_url'); ?> = root/wp-content/themes/simple-theme/style.css
Index.php
Code:
<?php get_header(); ?>
<div id="main">
<div id="content">
<h1>Main Area</h1>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<h4>Posted on <?php the_time('F jS, Y') ?></h4>
<p><?php the_content(__('(more...)')); ?></p>
<hr> <?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<div id="delimiter">
</div>
<?php get_footer(); ?>
index.php තමයි තිම් එකේ ඔක්කොම කැලි තනි පිට්වට සම්බන්ද කරන්න .
PHP Code:
<?php get_header(); ?>
header.php ෆයිල් එක
PHP Code:
<?php get_sidebar(); ?>
Sidebar.php ෆයිල් එක
PHP Code:
<?php get_footer(); ?>
Footer.php ෆයිල් එක
PHP Code:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<h4>Posted on <?php the_time('F jS, Y') ?></h4>
<p><?php the_content(__('(more...)')); ?></p>
<hr> <?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
මේක ලූප් එකක් , ඔයා Wordpress Blog එකෙ පෝස්ට් දාල තියෙනවනම් එ පොස්ට් ටික තමයි ඔතන්ට එන්නෙ .
PHP Code:
<?php the_title(); ?>
Title of Post
PHP Code:
<?php the_time('F jS, Y') ?>
Time Posted
PHP Code:
<?php the_content(__('(more...)')); ?>
Read More ==> on karala thiyenawanm oka watenawa .
Style.css
Code:
/*
Theme Name: Theme name
Theme URI: theme url
Author: author
Author URI: http://wordpress.org/
Description:description
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: twentythirteen
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
body { text-align: center; }
#wrapper { display: block; border: 1px #a2a2a2 solid; width:90%; margin:0px auto; }
#header { border: 2px #a2a2a2 solid; }
#content { width: 75%; border: 2px #a2a2a2 solid; float: left; }
#sidebar { width: 23%; border: 2px #a2a2a2 solid; float: right; }
#delimiter { clear: both; }
#footer { border: 2px #a2a2a2 solid; }
.title { font-size: 11pt; font-family: verdana; font-weight: bold; }
මේක ගොඩක් වැදගත් මේකෙන් තමයි තීම් එක ලස්සන කරන්නෙ .
Sidebar.php
Code:
<div id="sidebar">
<h2 ><?php _e('Categories'); ?></h2>
<ul >
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
</ul>
<h2 ><?php _e('Archives'); ?></h2>
<ul >
<?php wp_get_archives('type=monthly'); ?>
</ul>
</div>
Footer.php
Code:
<div id="footer">
<h1>FOOTER</h1>
</div>
</div>
</body>
</html>
දැන් හරිනෙ? උබලට ඔනෙනම් ඔහොම ෆ්යිල් ටික හදල ගිහින් තීම් foldeර් එකත දාපුණම බබා ව්ගෙ වැඩ . අවසන් ප්රතිපලය
ේප් දෙන්න හොදඇ