Help on integrating wordpress posts into yetishare

kmsoft1565737

New Member
YetiShare User
YetiShare Supporter
Feb 15, 2016
1
0
0
Hi, I'm trying to integrate wordpress posts to yetishare frontpage,
I created a forlder named "blog" in my host root and installed wordpress on it,
and for integrating wordpress in the main site I should first grab the wordpress blog header using this:

Code:
<?php 
define('WP_USE_THEMES', false);
require(WEB_ROOT . '/blog/wp-blog-header.php');
?>
then with this code I should be able to get latest posts:

Code:
<?php
// Get the last 3 posts.
global $post;
$args = array( 'posts_per_page' => 3 );
$myposts = get_posts( $args );

foreach( $myposts as $post ) : setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br />
<?php endforeach; ?>
I created a php file named "_index_blog_section.inc.php" in "templates/partial" directory of my theme and put these two blocks in there,
and with putting the following code in the "index.html" file of my theme:

Code:
<?php include_once(SITE_TEMPLATES_PATH . '/partial/_index_blog_section.inc.php'); ?>
I should be able to get my posts from blog, but when I upload these files, the whole site goes blank! and nothing shows up.
so my question is, what am I doing wrong? please help me out?
thanks a lot
 

rexcarnation5449

Member
YetiShare User
Oct 8, 2015
36
0
6
Why you dont use javascript then fetch the wordpress rss posts ?
I think its almost simple than use those php
 

sukhman21

Member
YetiShare User
Jan 26, 2015
508
3
18
Dont know much about pulling posts from wordpress but maybe try using full file path instead of /partial/....
or try using ./partial/_index_blog_section.inc.php try the . in the front....

Or as mentioned above, try RSS feeds and format them.