Displaying the image in other div - wordpress [closed] - php

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

Related

How can I replace html elements with php? [closed]

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.....

How to linking to a div in html? [closed]

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 8 years ago.
Improve this question
I have a list of links and the content of links are in that page, how can I link to a place of the page?
for example:
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
How can I link to div3
Make use of the id for div3 like this:
Link to div3
<div id="div1">
content content content content content
</div>
<div id="div2">
content content content content content
</div>
<div id="div3">
content content content content content
</div>
Here you can read more about it.
Use an anchor to refer to your div ID.
Link to div3
You can find some documentation here: http://webdesign.about.com/od/beginningtutorials/a/aabg020899a.htm
link to name1
<a name="name1">Name1</a>
Is the original structure from netscape.
Both of these work today.
<ul>
<li> 1
<li> 2
</ul>
<div style="height:100%" id="name1">Name1</div>
<div style="height:100%" ><a name="name2">Name2</a></div>

PHP Using a variable from an include [closed]

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 8 years ago.
Improve this question
I got a simple PHP code like this one:
<div id="master">
<div id="info">
<?php include 'division.php';
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php include 'lastmatches.php';?>
</div>
</div>
</body>
As you see i want to echo $winrate, but $winrate is a variable that comes from lastmatches.php. So it will never work. Some has got an idea to echo $winrate in the div info? Im stuck and i hope you guys can help me out!
Thanks in advance!
You need to include lastmatches.php before to define $winrate.
But if this file outputs some content then you will want to use the caching system to output the right content at the right place.
<div id="master">
<div id="info">
<?php include 'division.php';
// begin cache
ob_start();
include 'lastmatches.php';
// end cache
$lastmatchescontent = ob_get_clean();
echo $winrate;
?>
</div>
<div id="lastmatches">
<?php echo $lastmatchescontent; ?>
</div>
</div>
</body>
i suggest you to follow MVC approach, if you do not want to use framework u can do something like this: https://github.com/LPodolski/basic_php_templating
this will allow code to be more readable, by separating concerns of generating output from getting data from db, parsing it etc

Strange variables. XSL [closed]

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.

fatal error in my free web hosting site? [closed]

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.

Categories