i building wordpress website html/css/js templates made earlier. first time using , im struggling. there plenty of resources , solutions none seem working me, example; 1 tutorial pointed out create template pages if go management screen > pages > add new > page attributes > template. under page attributes "order" although claim there should template bit if click help.
i've managed link stylesheet none of images appearing. in folder named images within theme directory.
in external stylesheet have:
body{ background:url("images/subfolder/image01.jpg"); } i have tried:
body{ background-image:url("images/subfolder/image.jpg"); } in html have:
<img src="<?php echo get_template_directory_uri(); ?>/images/subfolder/image02.png" alt="description" /> i have tried:
<img src="<?php bloginfo('template_directory'); ?>/images/subfolder/image02.png" alt="description" /> i can't seem of these up.
here deal:) folder structure "must"
-yourtheme folder
index.php
style.css
page.php
single.php
...other files
-images (images folder)
-js (js folder)
so if developing theme full image path not because don't know how clients domain look, can http://www.mydomain.com/somefolder/ can http://www.mydomain.com/somefolder/subfolder/anothersubfolder access images use relative paths this:background-image:url('../images/myimage.jpg'); way images work no matter how domain path look.
now templates:)
in order wordpress recognize having template create file , name mycooltemplate.php (you can name want) first line inside template file must read this:
<?php /*template name: cool template*/ ?> that way wordpress know using template , can access inside
management screen > pages > add new > page attributes > template so give real world example let's create our first template shall we? create simple archive template.
open text editor , add code
<?php /* template name: cool archives template */ get_header(); ?> <div id="container"> <div id="content" role="main"> <?php the_post(); ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php get_search_form(); ?> <h2>archives month:</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <h2>archives subject:</h2> <ul> <?php wp_list_categories(); ?> </ul> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?> save archives.php (name want) , upload theme folder. folders should this:
-yourtheme folder
index.php
style.css
page.php
single.php
archives.php (your first template yeeey!!)
...other files
-images (images folder)
-js (js folder)
hope helps...
Comments
Post a Comment