I know this is a fairly simple task but I think there's something I'm missing here. I want to put in a PHP page I have built from another site into my current Wordpress site, beneath the content section and above the footer. There is no coding within this section, just content. It only needs to be called upon and appear where I need it to on the page.
Some searching has lead me to believe it belongs in the page or single template before the footer. I've tried include tags and the like without any luck. Can anyone shed some light on this? Any help will be really appreciated.
Go to the footer.php from your Wordpress theme and add
<?php include once("/path/to/your/script.php"); ?>
after the last
<php get_sidebar(''); ?>
include.
It depends on your wordpress theme and layout. Basically you need to include this php file in the template for the page that you want it to appear on. Generally this is the index.php file for the post page and page.php for pages. You can check which template your pages are using by going into the dashboard and editing the page (the option is on the right hand side under 'template')
If you're unsure you may want to look here for more info:
http://codex.wordpress.org/Template_Hierarchy
if your php file located on other website/server you can use file_get_contents to get its content and display it in your page.
Go to single.php and put this code between get_sidebar() and get_footer()
<?php
$mycontent = file_get_contents('http://example.com/your-php-file.php');
echo $mycontent;
?>
Related
I'm working on a Wordpress website for someone and I have a question. I used an inspector (firebug) to check out the html of my site but I need to know where to find that bit of code in the Wordpress theme (Spacing) php files. There's no search all feature and going through all of them separately is ridiculous.
I really appreciate any help you can offer!!
I found an article on it (https://wordpress.org/support/topic/search-through-php-files) but there really wasn't a solution. If I can find what I'm looking for in the HTML (it's a menu name by the way), why can't I go find it in the theme files??
I don't know if this matters but the HTML is a body class to a couple of div classes to a ul id to li id to an a class.
WP does not contain ant HTML page. Everything in WordPress php file. If your page is created in page section you have to check in page.php file in /wp-content/themes/{your theme name}/page.php or if your page is posts you to check in post.php
What you want to change in WordPress site ?
If you go into the back-end/admin section and click "Pages". Find the page you are working on and click edit. In the "Page Attributes" you can see what "Template" it is using.
Then you can find that template in /wp-content/themes/yourtheme/
EDIT: More than likely the header and navigation is located in the "header.php" file in the themes folder.
I installed a Wordpress theme, but I would need to put there my own HTML code.
So, I would suppose I'll go into: wp-content/themes/theme_name/header.php and on the needed place I inserted needed HTML code.
I did it, but it didn't affect the website - the newly put HTML elements are not seen in the website.
Do I disregard anything? Or is needed to set up something in the WP administration?
Or problem with cache?
Sorry, maybe a stupid queston, I am just playing with WP for the first time.
The pages of your blog are created from different theme "parts". header.php is one of them. it creates the header of the page. Usually, before most HTML is output. footer.php is used for the footer of the page.
If you want your HTML code to go in the homepage only, use index.php (which calls header.php and footer.php). If you want your code to show in a page, use page.php. If you want your code to show when viewing a post, use single.php. Hope this helps.
Look in your different pages if get_header() function is called correctly. It is this function that includes header.php.
Check also your "theme_name/inc" directory. Sometimes the header.php or footer.php can be placed in the main theme folder and in the inc. If that is the situation you need to make sure to be editing the right file (the one in /inc).
First you have to check in wp-admin which theme is actives in your site suppose there are three theme and twenty eleven is active and you were checking twenty twelve so maybe this reason your new html will not shown in front-end so please check your current theme and work according to that from this location you can check it your current theme go to wp-admin => appearance => themes
Please make me correct where is the problem and what should i do,
i am trying to make my custom page template in wordpress. Also the default landing page,
What i did is, just created a file jp_home.php and set the Template Name: name here.
And then create a page with the name home and select the theme for the home page, second i went on the settings>reading> and select the a static page and select my home page as a landing page.
All these changes i have done in themes/twentyeleven/ template.
NOW the problem: in jp_home.php
<?php
/**
* Template Name: WebTech Eleven
*/
//get_header('new');
?>
<!-- Wrapper Start -->
<div id="wrapper">
Here is my Page
</div>
<!-- End Wrapper -->
<?php
get_footer();
//require("footer_old.php");
?>
after commenting the get_header() i am still viewing my header.php i don't know why?? and the rest part not visible. Can anyone please explain what wrong i have done??
?>
Well if you still see the content from the header and none of the changes/additions in your jp_home.php then WordPress isn't pulling up that template file.
It sounds like you're doing everything you need to but lets just review how to accomplish what you're looking for.
Ensure that you have jp_home.php in the twentyeleven theme directory. With that in place, go ahead and create your Home page. Select WebTech Eleven under the Template option and save the page. After that, go to your Settings > Reading and make sure that your Front Page is set to display a static page, and set that to Home.
Make sure you are then actually navigating to the correct home page and you'll see the new template in action (a good way to do this is to navigate to edit your Home page and click "View Page"). I just tested all of this locally and it works for me.
Very clear and concise tutorial here also: http://wsmithdesign.wordpress.com/2011/01/19/creating-a-custom-wordpress-home-page-template/
Go to Pages -> All Pages and open the page you want to use the template on (THAT static page in your case). On the edit page, did you choose "WebTech Eleven" under templates?
Also, I must ask. Have you tried clearing cache on client side, and server side if you're using any cache there?
I have a page in HTML(index.html), and a folders named images, css, js that used in it.
Now i have to do this in WordPress. Is there any plug in to convert Html to WordPress or any other way to do this in WordPress? Please help me.. i'm a beginner in WordPress.
I am not sure of a direct way to implement a HTML page into a WordPress theme, but if you have made header and footer files for your website, then all you need to do is convert them to make them WordPress compatible.
You should refer to the codex.
You can also go for any of the WordPress frameworks listed here.
A WordPress theme is easy to understand if you know basic PHP. It has a set of files like
header.php // header file
footer.php // footer file
index.php // the index file
page.php // for your WP pages
single.php // for your WP posts
and some other files
Go through the codex and it shouldn't take long to get the hang of it.
You need http://themematcher.com/
It'll automatically take your site, styles, images etc and create a wordpress theme for you. Check it out
Search for HTML to WordPress theme conversion and you can find so many good tutorials.
Check this article:
http://thethemefoundry.com/blog/html-wordpress/
Theres really only three ways:
Hire a freelancer
Convert manually by referring to http://codex.wordpress.org/
Use an automated converter. Best one on the market is
https://htmltowordpress.io
here is the link for complete solution of this problem.
http://wordpress.org/support/topic/how-to-integrate-htmlphp-page-to-wordpres?replies=6
make sure to add
/*
Template Name: Custom Page Template
*/
piece of code in index.php page at top in your selected theme folder, not on ur main index.php file.
I've created an HTML page as part of my website which I would like to use as a template for news articles. The page has all the things it needs, it just needs to display the correct news article in it.
I installed WordPress on my webserver and now wonder how I can have wordpress publish articles using my HTML page?
Is this even possible since WordPress works with php?
thanks
What you are talking about is themes. Wordpress allows you to create a theme for your installation so it displays using your html/css (more or less)
The way I do this is copy the default theme and make changes in there, and then you can switch to your new theme in your settings.
Edit: in addition, you can also load up wordpress on any page using:
include( '/path_to/wordpress_install/wp-load.php' );
This will allow you to use wordpress functionality on any page of your site.
just edited the single.php file by pasting the desired html code and leaving the loop code there where the text needed to show up.
didn't need to break up the page in a header, body and footer. Left out sidebar for now, but will put it back after I edit it properly.