-2

I'm just created a website using wordpress and a custom theme for it. This is my theme directory

/themes/customtheme/
 -index.php
 -header.php
 -footer.php
 -blog.php
 ....

The index.php includes header,footer,information to shown on my website, and a link to my blog page.

Blog file will looks same ask normal blog site.

may i know how to wite a hyperlink(a href) in index.php under theme directory so that it can prompt to the blog.php when click? Blog

1

You don't need to create custom php file to do that. Basically, Wordpress is for blogging. You just have to create a Category named Blog and create some post under Blog category and in your folder theme just create category.php to show all your post. I suggest you to have a look Wordpress Template Hierarchy. It helps you to build a custom theme for Wordpress. https://codex.wordpress.org/Template_Hierarchy

  • May i know to to link between theme file IF my index.php is all my blog posts, and i need a link to this index.php from a home.php(which is the main page of the website). e.g a href="", www.mysite.com/blog for blog post page – user3182249 Mar 26 '15 at 5:33
  • I don't really understand what you want to make. But for create a category link you can use get_term_link('blog', 'category'). And to display all blog post in index.php I usually use get_posts function. Here is the documentation codex.wordpress.org/Template_Tags/get_posts. – Lidya Holmes Mar 27 '15 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.