Highlighted

Adding Wordpress posts to HTML website, which uses Dreamweaver templates.

New Here ,
Dec 10, 2019

Copy link to clipboard

Copied

I have a website that I created in Dreamweaver, and the pages use a template for the top menu, which I developed with Bootstrap. I wanted to add a blog, and thought I would just create a blog in Wordpress and then create a page that pulls the blog posts from the Wordpress site to a page on my website. So, I created blog.php and added the website template. However, I'm not getting consistent, good results.

 

My first questions is, is this going to work? Is there something inherently incompatable about using templates on a .php page?

 

Next, where should I put "<?php
define('WP_USE_THEMES', false);
require('wp/wp-blog-header.php');
?>"? At the top of the page or in the editable instance labeled "head" in the template?

 

Finally, what should my PHP look like to pull posts from Wordpress? I've tried a bunch of different bits of code I've pulled from different forums, etc., and nothing I have found works consistently.

 

I've done this before with a previous website, but that one I built as one big PHP page instead of a bunch of HTML pages that link to one PHP page—a PHP page which should (hopefully) look no different form the PHP pages. 

 

Any suggestions?

TOPICS
Bootstrap, Code, How to, Server side applications

Views

980

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adding Wordpress posts to HTML website, which uses Dreamweaver templates.

New Here ,
Dec 10, 2019

Copy link to clipboard

Copied

I have a website that I created in Dreamweaver, and the pages use a template for the top menu, which I developed with Bootstrap. I wanted to add a blog, and thought I would just create a blog in Wordpress and then create a page that pulls the blog posts from the Wordpress site to a page on my website. So, I created blog.php and added the website template. However, I'm not getting consistent, good results.

 

My first questions is, is this going to work? Is there something inherently incompatable about using templates on a .php page?

 

Next, where should I put "<?php
define('WP_USE_THEMES', false);
require('wp/wp-blog-header.php');
?>"? At the top of the page or in the editable instance labeled "head" in the template?

 

Finally, what should my PHP look like to pull posts from Wordpress? I've tried a bunch of different bits of code I've pulled from different forums, etc., and nothing I have found works consistently.

 

I've done this before with a previous website, but that one I built as one big PHP page instead of a bunch of HTML pages that link to one PHP page—a PHP page which should (hopefully) look no different form the PHP pages. 

 

Any suggestions?

TOPICS
Bootstrap, Code, How to, Server side applications

Views

981

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 10, 2019 0
Adobe Community Professional ,
Dec 10, 2019

Copy link to clipboard

Copied

Occam's Razor states: “the simplest solution is almost always the best one.”  Use WordPress for your entire website 🙂  

 

Or locate the WordPress RSS feed on your server.

https:// example. com / feed /

And use the online RSS2HTML tool below to generate a <script> to pull the WP feed into your HTML page.  I recommend doing this with JavaScript instead of PHP.  

https://rss.bloople.net/

 

 

 

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 10, 2019 1
New Here ,
Dec 11, 2019

Copy link to clipboard

Copied

No thanks. I would rather not re-create my entire website. Plus, I like the look that I have.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 0
Adobe Community Professional ,
Dec 11, 2019

Copy link to clipboard

Copied

I think you missed my point.  You don't need to re-build your website.  You just need your WP RSS feed.

 

For this working demo, I used my blog's RSS feed and entered it into the online RSS2HTML generator. This is an ordinary HTML file,  no PHP required.

 

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap 4 with RSS2HTML</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style>
.posts h4 {
font-size:1rem;;
line-height:1.5;
text-indent:1rem;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8 posts">
<h3>My Awesome Blog Posts</h3>
<!--RSS2HTML script-->
<script src="https://rss.bloople.net/?url=https%3A%2F%2Falt-web.blogspot.com%2Ffeeds%2Fposts%2Fdefault%3Falt%3Drss&detail=-1&limit=7&showtitle=false&type=js"></script>
</div>
</div>
</div>
<!--Supporting scripts. First jQuery, then popper, then Bootstrap JS--> 

<!--latest jQuery 3--> 
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> 

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> 

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>

 

 

 

 

 

 

 

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 0
Adobe Community Professional ,
Dec 11, 2019

Copy link to clipboard

Copied

I think I understand your question.

 

personally I have often used this process, which consists in using Wordpress' back office system, and all the WP class to manage its displays outside the traditional templating (a bit like using laravel, or zend).

 

the first step, as you did, is to tell wordpress that you are using its framework but not its rendering engine.
https://codex.wordpress.org/User:Jalenack/Integrating_Wordpress_into_an_Existing_Site

 

then, everything is in the codex... (https://codex.wordpress.org/)

 

for reading and displaying posts , the loop will be your best friend, https://codex.wordpress.org/The_Loop, but also the global $wpdb https://codex.wordpress.org/Class_Reference/wpdb.

 

you can also use a database external to WP, but thanks to WP you can also deploy the necessary set of tools
https://wordpress.stackexchange.com/questions/1604/using-wpdb-to-connect-to-a-separate-database

 

now, in order to help you in a more precise way, do not hesitate to better frame what you need, and we will be able to guide you in the process

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 1
New Here ,
Dec 11, 2019

Copy link to clipboard

Copied

I have my wordpress code in a subfolder, /wp/. What I cannot find in the PHP code I'm reviewing is any command that says "find the PHP-related filed in /wp/. So, maybe there is something basic that I am missing that everyone assumes I should know?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 0
Adobe Community Professional ,
Dec 11, 2019

Copy link to clipboard

Copied

is you first page calling the PHP classes located directly at the root server, on the same level than you wp folder  ?

so try

require('./wp/wp-blog-header.php');

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 0
Adobe Community Professional ,
Dec 12, 2019

Copy link to clipboard

Copied

Just to be clear, the OP wants WordPress posts to display in HTML files.  I have demonstrated how to do this with a WP RSS feed and JavaScript. 

 

PHP includes will NOT work in HTML files on an ordinary server set-up.

 

 

 

 

 

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2019 0
Adobe Community Professional ,
Dec 12, 2019

Copy link to clipboard

Copied

where did you read that the OP works on an HTML files... here is what I read, I copy paste frome the original post

"... My first questions is, is this going to work? Is there something inherently incompatable about using templates on a .php page?..."

isn't it a PHP page that we talk about ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2019 0
Adobe Community Professional ,
Dec 12, 2019

Copy link to clipboard

Copied

The topic title says it all.

"Adding Wordpress posts to HTML website, which uses Dreamweaver templates"

 

Honestly, I don't think the OP knows how to work with PHP code.

 

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2019 0
Adobe Community Professional ,
Dec 12, 2019

Copy link to clipboard

Copied

I hadn't seen it that way... maybe you're right.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2019 0