link static php files to nav header on wordpress - php

I've in header.php list items containing:
home
about us
support
contact us
I need to link them with php files in my theme in wordpress:
index.php
about-us.php
contact-us.php
support.php
I tried for home this code:
<li>Home</li>
and worked with home page only.. so what about the other files
I need something similar to
about us
because any page have included different header, footer and other

Hi Can you try this code
<li>about us</li>

Related

Convert html to wordpress & provide link to menu inside panel

I have an HTML template which I am trying to convert into PHP for WordPress.
The homepage has been converted and is shown properly. Next, the menu in navbar is about, the page that needs to be converted in PHP.
I have just added get_header() at the top and get_footer() below. In between these two I have added the HTML content for my entire page.
Then I tried to provide the link for the menu that I created, but the content of about page is not visible.
Do I need to add any other line for that page apart from get_header and get_footer? Or is something wrong with the link?
Clearly I can't understand what your are trying to say. I think you want to create a page that will show your about menu content.
So in your theme directory create a page name page.php and use get_header(); in first and below get_footer and where you want to show page content write the_content();. like this
<?php
get_header(); ?>
<div><?php the_content(); ?></div>
<?php get_footer(); ?>
after that follow the url of # Sajid Anwar. because for dynamic data you have to create pages(home,about etc) from wordpress dashboard and in menu section add these pages as navigation menu to menu.

Cannot Remove Sidebar from Archive Pages in Wordpress

I have a theme that I am developing using the _s (aka: underscores) theme.
I do not want my archives to include the sidebar.php file.
My archive.php and paged.php files do not have the sidebar.php
included.
I created a home.php file which includes the get_sidebar()
function, and edited my index.php to not include that function.
I'm still seeing my sidebar when I click "Older Posts" on my site which brings me to: MYDOMAIN/?paged=2 -- this is not what I want.
Specific archive pages (such as for months and categories) do not display the sidebar, which is what I want.
I only want the sidebar to appear on the front page of the site.
I checked the body tags on my home page and on the paged "Older Posts" archive pages to determine what template is being rendered.
Home page:
<body class="home blog">
paged "Older Posts" archive page:
<body class="home blog paged paged-2">
This leads me to believe they are both using the home.php template. How can I get those pages to use a different template?
What am I doing wrong?
A friend helped me resolve this issue and I thought I'd share our solution. In order to make sure the sidebar appeared only on the front page of the blog and not appear on the ?paged= pages, we added some conditional statements around the call to the sidebar on home.php:
<?php if ( !is_paged() ) { ?>
<?php get_sidebar(); ?>
<?php } ?>
Additionally, this code could be added to the sidebar to keep it from appearing on other pages such as category pages, single posts, etc. While this wasn't necessary since I had used specific templates for those pages that did not include the sidebar, here it is in case it's useful for others:
<?php if ( is_front_page() ) { ?>
<!-- ALL CODE FOR YOUR SIDEBAR HERE -->
<?php } ?>

Removing <div id="page" class="hfeed"> from wordpress pages

I need to create a page which is an exact copy of my index.php page. I have duplicated index.php and renamed it page-newindex.php and included
/*
Template Name: homepage
*/
at the top of the page so I can select it as a template when creating a new page.
The problem occurs when the page is rendered. Becuase it is a 'page', a containing div which looks like this: <div id="page" class="hfeed"> in included which all of the other html is inserted into. This is causing major formatting problems.
How do I get rid of this containing div??
<div id="page" class="hfeed"> this is added in header.php.
If you remove it from header.php then it will affect all the pages. So create a custom header for homepage template.
Copy header.php and paste in a new php file & name it as header-home.php
In the header-home.php, remove page id and hfeed class from div. ie just keep <div>.
In homepage template, instead of get_header() call get_header('home');
With this you have a separate header from which you can remove page id from div.
Hope this helps.

how to link a page url to wordpress

I'm new to WordPress, I just converted my HTML to WP Theme, but now I'm facing a problem, I couldn't get to work the linking of pages.
The structure of my theme:
index.php
header.php
sidebar.php
footer.php
services.php <- other page in the site
Here's the sample code from index.php:
<div id="menu">
<ul>
<li><a class="current" href="#">Home</a></li>
<li>Services</li>
<li>Free Quote</li>
<li>Customers</li>
<li>About Us</li>
<li>Contact us</li>
</ul>
</div>
But whenever I try to go to services, it's giving internal server error. I don't know why it's happening.
There are two ways in wordpress for linking Pages
For Content Based pages only:
You need to create a page from wp-admin(Admin panel) and can specify the slug of the page
E.g:
<li>Services</li>
^This is called Slug
This page will always run from page.php.
For HTML Changes Pages:
You need to create a page from wp-admin(Admin panel) and create a file containing
page-slug.php, here slug will change according to the name of page.E.g:
Services page will become page-services.php, in this you can insert your own html.
This will run from page-services rather than page.php
Choose as per your requirement.
Try using:
<a href="<?php echo bloginfo("template_url")?>/services.php">
I think in this case you are just not echoing out the value of that function. Also, however you might want this instead:
<a href="<?php echo home_url() ?>/services">
The template_url goes to your theme's folder, not to your website's homepage. I assume the latter is what you're really going for.
try <php echo site_url()."/sevices.php"; ?>

php smarty template structure

and i am creating simple php application with using smarty
i have file header, left ,body, and footer.
main index.php and
tpl file in templates folder containig templates.tpl other design tpl
i am calling in templates.tpl in index.php
index file contains url encode code.
i have also folder shop which have shop.php and same with other menu ...
i have configured smarty well but not succeed?
i have menu in header and left
when i click in menu than it will be not display the content in only body part
exa: header and left part has menu like home, contact us , shop and etc .....
i want click content in body part and header left and footer as usual through the all pages?
if i click on shop it will be display in new file and which containing the urlencode which shows in browser ?
i hope you understand my question ?
This is what I understand from your question-
You have index.php which renders to templates.tpl template and shop.php with some menus(Not clear if both have the same menus or different)
Are you rendering shop.php output to some template? like shop.tpl, if so..
You can have a structure something like
templates.tpl
{include file="menu.tpl"}
<!-- Templates body -->
shop.tpl
{include file="menu.tpl"}
<!-- Shop body -->

Categories