WordPress page link goes very wrong - wordpress

I'm building a theme that would have essentially 2 pages, one would be a workshop, and the other would be an art page.
The main page for the domain has header(), footer() the content file is named front-page.php where I noticed that WordPress disregards the "Reading settings" of "Your homepage displays" ( Your latest posts / A static page )
I've created art-page.php to include new headers and footers for art (header('art'), footer('art'))
I followed the WordPress Codex of creating a new page, so art is a page I've published, seen that it's ID is 1742, I created the home page link to art as: <div id="art-link"></div>
Result:
When pressing on that link, it loads /the-art with a 200 response, including all the css and js for it, yet it loads the home page and under the footer of the home page it creates another home page with the header, then in the content a row with "art" (the name of the page) following by the main footer.
Expected result:
From the home page, click on the art link from above, wordpress will load art page (art-page.php) as a whole new page.
art-page.php
get_header('art');
?>
</div>
<h1>test art</h1>
<?php
get_footer('art');
?>
I'm a programmer with a basic grasp of the wordpress, yet struggling to create the expected result above.
Thanks,
Bud

I now study how to make a theme in wordpress.
First you need an Index.php file and a style.css file (these two files are the minimun)
You can cut the upper part of index.php and create the header.php an the down portion and create the footer.php.
You can have a static page as 1st page and the filename can be front-page.php and another page for blog.
BUT if you want to see a set of archives you use archive.php (post in same category, or of the same author e.t.c)
IF you want to see a post (one) you use the single.php or page.php for a single page.
In wordpres we have pages (static content like About us) and post this can written new info from author.
If you have difficulty, read a givem default theme, or use a starter theme and convert it to what you want.
Some starter themes to use are:
https://underscores.me/ (from authors of wp)
http://jointswp.com/ (Freamework foundation)
https://understrap.com/ (Bootstrap 4)
Before to start read about theme hierachy in wordpress
https://developer.wordpress.org/themes/basics/template-hierarchy/
example themes
https://medium.com/pixelperfecthtml/step-by-step-guide-to-convert-html-template-to-wordpress-theme-8d89264eb4be
https://www.elegantthemes.com/blog/tips-tricks/converting-html-sites-to-wordpress-sites

Related

How to add the Schema.org markup (generated by the Structured Data Markup Helper) to specific WordPress pages?

I have used the Structured Data Markup Helper and now need to add my mark-up code. Do I add this to the main head section of the website or just the individual page head.
I assume this needs to be added to the specific page head but I'm not sure where to access this. I am using Wordpress and normally add mark-up to the child theme header.php file in my cPanel but this is for all pages.
if(is_page('home')){ ?><!-- home page with slug home
enter your schema code for homepage -->
<?php }
else if(is_page('career')){ ?><!-- career page with slug career
enter your schema code for career-->
<?php }

how to create static front page without using index.php

WordPress:
I am trying to create a Static Home Page without using index.php
I have created a post page using index.php
I have created a front-page.php for the Home-Page.
I go to Setting>Reading>Front page: Home and then again
Setting>Reading>Posts page: (Name of Post page)
My Problem: Front-page showing "PostPage"
How to solve this issue?
You should create a template name for your front-page.php.
Add this lines before the get_header();
<?php
/*
Template Name: homepage(or everything you want)
*/
?>
After that go to pages on wordpress and add to the page you want to set as frontpage the template homepage(or everything you want).
Go to Setting>Reading>Front page and set the page which has the template as front page.
I found this answer. I made a copy of index.php and renamed it home.php. And its working nice!

Wordpress: create a custom home page

I want to create a website using wordpress, but I want my website to have a customized home page, created by me, completely different from the theme of the site, and then link the wordpress pages directly from my page.
Is this possible? How can I achieve this?
Can I simply create the page, and link the other created with the wordpress panel, without breaking everything?
According to official WordPress codex:
If a visitor goes to your home page at http://example.com/blog/, the following happens:
WordPress first determines whether it has a static front page. If a static front page has been set, then WordPress loads that page according to the page template hierarchy.
If a static front page has not been set, then WordPress looks for a template file called home.php and uses it to generate the requested page.
If home.php is missing, WordPress looks for a file called index.php in the active theme's directory, and uses that template to generate the page.
Therefore you just need to create a home.php template and place it with the other theme (which so ever theme you will use) templates and WordPress will automatically start using home.php template for the home page.
Just copy the default page.php template file and call it front-page.php. Change the configuration at the top of that file. Now create a new page called home.
Go to Administration > Settings > Reading panel and set a static front page.
For more help check this link on the Wordpress website:
https://codex.wordpress.org/Creating_a_Static_Front_Page
If you create HTML off your home page first than this is easy for you
First Create a file Like this "template-home.php" in your theme.
Now in "template-home.php" First you must write these lines at the top of the page
<?php
/* ==========
Template Name: Home
========== */
?>
After that add your header.php and footer.php like this:
<?php get_header(); ?>
// Your Content is here
<?php get_footer(); ?>
Now your Whole HTML is work between in Header and Footer
Then Go to your Admin Panel
Go to Pages > add new
and create a page named "Home"
NOTE: When you create a page Please Select a Template of Home and "Publish" it.
Then go to Settings > Reading and select "A static page (select below)" radio button, then a drop down is active and select your "Home" Page Then click on save changes.
I hope this will help you
You can create a front-page.php file in your active theme folder.
It can be use for both Your latest posts or a static page as you want.

page.php and index.php error in wordpress theme

I have created index.php file and created a page called Home in wordpress admin section. I set the Home page as front page. It works fine.
And i have created page.php file. After creating this page.php file, the created Home page (front page) simply seems blank.
(Note: i did not do any design in page.php file)
My question is, when setting the front page it will call only the index.php. But why after creating page.php, the Home page takes the page.php file. Please help me.
If you have created a page called home and you have selected this page as the home page in the WordPress settings panel, your created 'home' page will assume the template to use is page.php - since it's a page. (check WordPress template hierarchy)
If you want to use the index.php template for your home page, add the following at the top of the index.php file.
<?php /* Template Name: Home */ ?>
Then navigate to that page in the admin panel, and select the template 'home'. Your page now uses the template 'home' which is index.php not page.php - that will sort the problem.
Template hierarchy is correct. To take further advantage of this you can copy and paste your index.php or your page.php code into a new file named home.php. WordPress recognizes this as your default front page (over index and page.php templates) if it exists.
To continue with the way you are attempting, duplicate index.php (or page.php), name this file page-home.php and at the very top add in
<?php /* Template Name: Home */ ?>
Save this to the theme folder. Create a page within the administrations "Page" tab. Make sure to choose the correct template (Home) from the dropdown on the right side of the edit screen.

Wordpress themeing

I am relatively new to wordpress, I am creating a custom theme, and so far it is going ok.
I currently have index.php, header.php, footer.php and sidebar.php.
I have now hit a bit that has been puzzling me for a couple of days.
My home page has a slightly different layout to other pages, how do I theme for that change?
My website is essentially made up, of 'static' pages and 2 posts pages, what can I do so that the homepage looks different to the other pages?
Create a page template called home.php. WordPress will use it automatically for the start page.
Example:
<?php
/**
* Template Name: Home
*/
get_header();
// Do your regular page.php stuff
get_footer();
See also the codex page an Conditional Tags.
Go into your dashboard, settings>reading, check what the setting is for your home page display. You may need to change it from the default "list of latest posts" to a static page of your choosing.
You need a front-page.php
Please see the template hierarchy
You need to use the built-in functions from wordpress such as is_home() and is_front_page().
Conditional Tags
If you have a front-page.php that will take precedence over home.php or page.php. Whether or not home.php or page.php are defaulted to (assuming you have both) can be controlled in Settings → Reading. If you do not have a front-page.php, home.php, or page.php, then index.php would be defaulted to.
One difference between home.php and front-page.php is that home.php defaults to being a blog index page. Though both home and front-page may be used to display static or blog index pages.
More info may be found Wordpress' Template Heirarchy page.

Resources