Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Fatal error: Call to undefined function get_header() in /home/a2260510/public_html/index.php on line 1
error code in below
When I refresh the browser then i see the error.
<?php get_header(); ?>
<div class="fix main_body_area ">
<div class="fix main_feature floatleft">
<div class="fix heading_area">
<div class=" heading floatleft">
<h4><img src="<?php echo get_template_directory_uri();?>/images/post_red_img.png"><div class="head_pan">Gruesome video shows Syria brutality</div></h4>
</div>
<div class=" heading_2 floatright">
<h4><img src="<?php echo get_template_directory_uri();?>/images/gray.png" alt="gray"><div class="fix head_span"><p><marquee>As crackdowns against anti-government protesters continue acrosss</marquee></p></div></h4>enter code here
</div>
</div>
<?php get_template_part('slider');?>
<div class="fix feature_area_images">
<?php get_template_part('image_widgets');?>
</div>
<div class="fix news_post_area">
<div class="fix head_news">
<?php get_template_part('post_loop');?>
</div>
</div>
<?php get_template_part('sidebar');?>
</div>
<?php get_footer();?>
</div>
You're using a wordpress theme as a standalone web app.
What you have to do is:
Go to http://wordpress.org/download/ and download the last version.
Upload the contents of the wordpress zip downloaded in your public_html folder.
Now you can put yout files (the ones showing the fatal error) in the wp-contents/themes folder.
Go to your site url, and install wordpress (help in here: http://codex.wordpress.org/Installing_WordPress)
It should work.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
CLARIFICATION: Being that I've never used PHP, it was unclear how to format the PHP file, so that when you include it in the index, then header(nav bar) would show up. No posts explained why I had to change my index.html to index.php to make it work. And again, being that I haven't used PHP, I was under the impression that changing the extension meant that I would have to convert my HTML code to PHP commands. I was trying to avoid having to change my whole code around. That's where the confusion was.
I was going to delete the question once I got it figured out. Then again, I'm sure I'm not the only person that may run into this while making their first website.
SOLUTION. Save only the nav code in html language with a PHP extension (header.php). Change index/home file from .html to a .php extension (don't have to modify any code. but accepts the include prompt). Then, include the header.php in your index.php. Same goes for your footer. Thanks for the help everyone.
*ORIGINAL POST: Through another post, I was told it would be easier to use a nav/footer on multiple pages by using PHP.
I created a file and tried including it and it is not displaying. I'm not sure what I am doing wrong.
There is some CSS in my nav bar as well, do I need to import the css file in the PHP file? or does the index.html file automatically attach to the included (php) file.
PHP Code:
<?php
echo '<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>';
?>
HTML Code (include):
<body>
<?php include '/header.php';?>
....other code....
</body>
If there's a problem with the PHP file, if I'm missing something, can someone show an explain please?
no need to add <?php ?> code in the header file just keep it as it is :
Create a new file named header.php and add this code to it
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
Include header.php anywhere you want
Remove the <?php tag from your code. As you generated html output. <?php tags are used to generate output by php.
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
If you want to use php tags, than you have to write the code in this way:
<?php
echo '
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
';
?>
Your problem is most likely the pathing of you include. Often you'd need to specify from the server root, and not just /header.php.
To specify your including-path, you could specify the root like this
include $_SERVER['DOCUMENT_ROOT']."/header.php";
You can also set the default include path in your php.ini file, thus making the $_SERVER['DOCUMENT_ROOT'] an automatic process, that can be done with running this code, that will alter your php.ini file.
ini_set('include_path', '/usr/lib/pear');
As others have pointed out, you don't need the contents of your /header.php to be echoed out as it's pure HTML. Anything that's included will be included the way it is, so having the contents of /header.php as pure HTML just makes for better practice, as it's easier to read.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a website in which I use just html, but I'd like to add one location where I would edit things like the nav and the footer. Then it would be instantly updated across the whole site.
So, for example, I'd like to put:
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Into
<?php echo $nav;?>
Any help would be greatly appreciated! =)
Add the html that you want to show into a file. For eg:
add this to menu.html
<nav>
<div class="nav-wrapper">
Logo
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
</div>
</nav>
Now include this page in other HTML pages wherever you want to call it like below
<?php
include 'menu.html';
?>
I like Lal's answer. I would change include 'menu.html'; with include_once 'menu.php'; The idea is that you will can add some php variables if you need them on some point.....
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm building a WordPress theme from scratch at the moment and I seem to be stuck on trying to add a logo to the top left corner of the page where you would normally see the title of the page.
<h1>
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a
</h1>
<div class="site-description">
<h3>
<?php echo html_entity_decode(get_bloginfo('description')); ?>
</h3>
</div>`
So instead of the h1 tag there, I would like an image that will allow the user to return to the homepage. Also would I need to save the image in a specific folder ?
Please help and thank you in advance !
try this
<img src="<?php bloginfo('template_directory'); ?>/images/logo.jpg" />
<div class="site-description">
<h3>
<?php echo html_entity_decode(get_bloginfo('description')); ?>
</h3>
</div>
assuming that image is in the images folder of template directory with file name logo.jpg
Use
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?>
<img src="image.jpg" width="32" height="32">
</a>
instead of
<h1>
<a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a
</h1>
Working well for me
See the image http://i.stack.imgur.com/Vs23W.jpg
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've such piece of code:
<xsl:template match="bottom">
<div class="l1">
<div class="l2">
<div class="fl100">
<div align="center">
<div class="mw" align="center">
<div class="footer">
<div class="f1">$-BOTTOM_COPY-$</div>
<div class="f2">
$-BOTTOM_CONTACTS-$
</div>
<div class="f3">
$-BOTTOM_LINKS-$
</div>
<div class="f4">
$-BOTTOM_STUDY-$
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I cannot understan where from $-BOTTOM_CONTACTS-$, $-BOTTOM_LINKS-$ etc variables are.
I'm new in xsl, and searched every src files, but didn't find any declaration of define in php code.
Any idea?
It looks to me as if someone has included these bits of text (like $-BOTTOM_STUDY-$) as a target for replacement with something specific. Either they intended them to be replaced in the stylesheet before running the transformation, or they intended them to be replaced in the output file after running the transformation. But as far as XSLT is concerned, they are just strings to be copied from the stylesheet to the result document.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to display the image of posts in other div then content's one.
I mean like this.
<div class="latest-posts">
<div class="latest-posts-info">
<div class="title"><h1>HERE IS TITLE<h1></div>
<div class="text">HERE IS CONTENT</div>
Read more...
<div class="clear"></div>
</div>
<div class="latest-posts-img">HERE I WANT THE IMAGE</div>
<div class="clear"></div>
</div>
While was adding a post in wp admin, i noticed its the only way, displaying image IN content.
Thanks
Check out this page : http://codex.wordpress.org/Function_Reference/the_post_thumbnail
<div class="latest-posts-img"> <?php the_post_thumbnail( $size, $attr ); ?> </div>
You can try to add a custom template for this post using this function:
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image