Dynamic body in html for making wordpress theme - php

Can you help me, please ? Maybe this question is stupid but I am new in Wordpress. First I have created project using html and css, javascript. Then, I have converted my html code to wordpress theme. For example I have written get_header() instead of html head and get_footer() instead of html footer. Finally I must do dynamic my project's body but I can't. For example when i change page, header and footer must stay in its place but body must changing. Problem is I do not know to write code in my body section. my code's seem
I have called my other section though get_template_part().
I have tried to write my html code in adding wordpress page, to be more clear, in wordpress dashboard. When I change page, body's seem must changing.
What should i do, please ?

In your templates add the HTML of particular pages like the home page and other cms pages and in the admin dashboard go to the Pages section in the page template and assign the particular page template for example you have created a home page template for the main page go to pages in admin dashboard in page template assign the home page to the page then you can see the HTML of the page on frontend.

Related

Must a WP landing page be in HTML or PHP?

I've been asked to create a landing page for a client's WP site. I don't have much experience with WP and wondering if the page should be an HTML or PHP file? I have a CSS and JS file too. Any advice would greatly be appreciated.
Take a look at the WordPress Codex on how to make custom themes. You could edit an existing theme although this isn't advised as you'll lose your changes when you update it.
The landing page must be saved as a PHP file. WordPress will automatically include the right file depending on the page that is requested. The most straightforward way to do this is create a file called template-landing-page.php and on the very first line of the file, paste this in:
<?php /* Template Name: Landing Page */ ?>
Then add your landing page content into that file. When you're done, go to the dashboard and edit/create a new page. Look for the Page Attributes meta box on the right hand side and select the Landing Page template. Save the page.
Then you have a new landing page!

opencart: How to add static html home page and change logo and navbar link to it

I am new to using Opencart and Php open source frameworks in general, and have been searching the forums and haven't found anything to create a non-default home page that is simply static html with no database it needs.
I was wondering how to do this in the source code, if it is possible.
So far I have created an index.html file and that shows up as the home page. But when I click the logo for the site, it goes back to the index.php file, to be exact: yourstoreurl/index.php?route=common/home
Secondarily, I will likely want more than one static page, not just home, and would like them to show up in the navbar where the tabs for your products are displayed. For instance, in the default site, have navbar links for "home" which I want to be static html, and "about" which I want to be static html, before "Desktops" and "Laptops and Notebooks" https://demo.opencart.com/
How could this be done?
The reason I want to do this is to have some written content at the entrance of the site, and have html & css experience so would like to create it that way.
Sorry, bro open cart is a database-backed app.
Use a custom static web page as your home page, put your shop in a subdirectory, and put a link on the home page to the shop.

How to make Wordpress Custom page

i m a newbie to wordpress. I have started theme development and encountered these problems. I think these kind of problem does have a solution, but i m not able to find it out.
I m trying to make a custom page. Uptill now i have made header, footer and main index page.
I see that whenever my theme is activated, I see these default index page, with header and footer assign to it.
I have also made some cutom about us , contact us pages using the Add Pages Functionality of wordpress.
My Problem:
1.Now I m trying to make custom product page where I will have more than 100 images on that pages, and then i can change the images, add the images and description and the link url in future. I have made some html code and put it in the text Tab . I can also see the images on the frontend of the Custom page. But my template breaks. Images goes up and description goes far below.
Also i wanted to add fancybox to all the images which are goin to be replaced or added. But again my template breaks.
So can we make custom.php page and do some coding or anything which you feel is the right way of doing it, Please let me know.
Firstly create product.php page in templates folder using below code on top
<?php
/*
Template Name: My Product Page
*/
get_header();
// write your code here
get_footer();
Then, assign the above template to the page in admin.
Then, that page you can call in menu.
For more detail, check here :- http://codex.wordpress.org/Page_Templates
Actually you don't really need to create a custom template for this unless if you are planing to use that same template on another page.
If your page name is products , just create a file called page-products.php in your theme root. and write your code inside that page.
If your planing to develop themes first be comfirtable with wp template hierarchy.
http://codex.wordpress.org/Template_Hierarchy

front-page.php overrides my custom page template wordpress

As the title says, I'm currently working on a theme and i've found a bit of a problem.
Let's say I make a page called test and give it the custom page template of test-page-template
so far that works fine if I go view the page but the problem comes when I set the homepage to use my page as the static homepage; what happens is instead of using the test-page-template it uses front-page.php.
The obvious work around would be to edit front-page.php to be the same as test-page-template but that's a bad solution if a client wanted to select a different page as the static front page. Any ideas?
This is happening because of the WordPress template hierarchy. Front-page.php takes priority as compared to page template, when it comes to the front page of the blog. Here is the heirarchy graph:-
I'm not sure of the complete requirements, but I would suggest you to use index.php and page templates in that scenario.

Link to custom php theme page in wordpress

I want to link a template php page (header.php) to a custom php page (cmenu.php) I made in the same theme.
I've searched on a lot of websites via google and also through the Wordpress Codex on how to accomplish this but I can't seem to find it.
In my header.php page I have a div which I want to have an url href link to my custom menu called cmenu.php. (I want to link it to that page to be more mobile friendly.)
I tried te following codes I found in the codex and google but none of them work:
get_cmenu()
get_template_part('cmenu')
Make the page you want to link to a template page and make a page and assign that template to it.
In a template page you can run all custom code you want.

Categories