Add recent post to PHP website
-
I’m trying to post the recent post of blog in the website, in “news” section; However, I made work almost all the code except the_permalink() function, this is the code that I have used to achieve it… you can see it live on https://www.cdci.com.co/noticias
I will appreciate help for this, working on a mail marketing campaign and this isn’t fully working =/
?Thanks!
Excerpt: Works
Post Tittle: Works
Permalink: (empty) Not working.I tried every answer on google the last three hours but still have no clue…
<?php include('blog/wp-load.php'); $recent_posts = wp_get_recent_posts(array( 'numberposts' => 3, 'post_status' => 'publish')); echo ''; foreach($recent_posts as $post1) {?> <?php $j++;?> <div> <ul class="ul" style="margin-bottom:0px; padding-left:36px!important;padding-top:10px "> <table width="100%" border="0" cellpadding="0" cellspacing="0" style="overflow-x: hidden; border-collapse: initial;"> <tr><td> <li><a href="<?php the_permalink(); ?>"><?php echo $post1['post_title'];?></a></li></td></tr> <tr ><td style="border: 0px solid black; background-color:#f5f5f5;"><?php echo nl2br(strip_tags($post1['post_excerpt']));?></td></tr> </ul> </table> </div>
- The topic ‘Add recent post to PHP website’ is closed to new replies.