1
I am creating a blog and would like to know how to do the following.:
On the home page I display the title, an image and a summary of the post, and when clicking on the "Read All" button, the post is opened completely in another browser window, as in internet blogs.
I am developing as follows: I made the entire layout of a site for a business in my city, more exactly a store of materials for construction, and was also asked for a news portal.
I’m just running tests on an external project, before incorporating it into the site code. I’ll post the code so you can see. I’m very lay with PHP, I’m using Notepad++ to develop my code.
<?php require( 'conectar.php') ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Blog</title>
</head>
<body>
<?php $sql=m ysql_query( " SELECT * FROM postagem ORDER BY data DESC"); $conta=m ysql_num_rows($sql); if($conta <=0 ){ echo '<h2>Nenhuma postagem encontrada.</h2>'; }else{ while($res=m ysql_fetch_array($sql)){ ?>
<div class="postagem"> <span> <h2><a><?php echo $res['titulo']; ?></a></h2> </span> <span> <h3><a><?php echo $res['postagem']; ?></a></h3> </span>
</div>
<?php }} ?>
</body>
</html>
I found the following function.:
function new_excerpt_more($more) {
global $post;
return ‘… <a href=”‘. get_permalink($post->ID) . ‘”>’ . ‘Ler matéria completa »’ . ‘</a>’;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);
I could apply it to my need?
Luis, your question is not related to php, at least not only. Can you explain better what blog you have and how you can change/create HTML on this page? or want to redirect in php by changing the
header
?– Sergio
Luis, we need more information to help you. Are you doing this whole blog from scratch without a framework? Have you tried anything? If yes put the code.
– Joao Paulo
I’m developing it this way. I made the entire layout of a site for a business in my city, more exactly a store of materials for construction, and also asked for a news portal. I’m just running tests on an external project, before incorporating it into the site code. I’ll post the code so you can see. I’m very lay with PHP, I’m using Notepad++ to develop my code. Sergio, I was unable to understand about this redirection as I said and about the header change. I didn’t even create the Read All button because I didn’t know the structure needed in PHP.
– Luis Fernando
Thanks Sergio, I’m beginner here at stackoverflow, I’m grateful for the instructions.
– Luis Fernando
You are using Wordpress or found this function by searching on Google?
– lfarroco
@lfarroco, I thought it would work adapting, I found on google, not use wordpress. It’s not working yet, I can’t open the full post. Could you help me with that? I found this tutorial, but I haven’t been able to understand anything that was explained in it, I just want to do how it was done there, I want to show all the summarized posts in my index.php, and open them when clicked on the Read All button, in a _Blank window with the same design, only with the complete posting.
– Luis Fernando