0

I am intergrating WordPress with a non WordPress site. I have installed WordPress at my evercam.io/wordpress and I have followed the codex and I have been able to display a list of posts on a static page that I have on my site at evercam.io/blog. I don't want the visitors to my site to ever get to the WordPress theme.

Where the problem lies is if the user clicks on the title of a post that is listed at my site.com/blog it brings them to evercam.io/wordpress/the-post-title.

I have tried to create an equivalent of single.php on my site using:

<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('/server/path/to/your/wordpress/site/htdocs/blog/wp-blog-header.php');
query_posts('showposts=1');
?>

<div class="col-md-8 col-sm-8 col-xs-12">

 <?php while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p><a href="<?php the_permalink(); ?>" class="red">Read more...</a></p>
<?php endwhile; ?>

</div>

So if someone visits evercam.io/single they will see a single post. What I need however, is the title of each post on my blog page to link to each corresponding single post.

Is this possible at all? I have gone through many blog posts and the closest possible solution I found was to disable the link on the blog post title which doesn't really solve my problem!

2 Answers 2

1

If I understand your needs correctly, you would like to have your /blog page and post items aggregated and driven by WordPress without exposing the user to anything WordPress.

To solve the problem with "wordpress" being in the url, you should actually be putting the entire contents of the WordPress install into the website.tld/blog directory. Make sure you update any custom code you wrote to match the new location.

The next step would be to use style information from the current look of your website on the active theme's style.css, modifying it to change the look of the generated lists and pages.

I don't think a single.php can be used anywhere outside of a theme directory.

2
  • Yes you seem to have understood what I'm trying to achieve thanks! If I put the entire contents into /blog, will I not just end up with the index page of my wordpress site appearing when I got to evercam.io/blog in that case? or do I remove the WordPRess index.php and replace that with my own index.php which is my current blog page (not wordpress)?
    – Ciarán
    Commented Oct 22, 2014 at 11:48
  • This is more best-practices, but I think it may help you overall: WordPress is more ecosystem than blog-page plugin, and the core is definitely not built to be manipulated at all. The WordPress index.php ultimately is programmed to load your theme (while rewriting URLs so that no one is the wiser), and all modifications you would like to do should be inside there. For the very basic functionality you seem to require, most people would start with a bare-bones theme like underscores.me. Modifying the theme's index.php and single.php style.css should accomplish what you are looking for. Commented Oct 22, 2014 at 12:03
0

I was actually able to achieve what I wanted with this also. http://blog.beacontechnologies.com/how-to-pull-wordpress-posts-into-external-website/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.