Jump to content

Recommended Posts

So i found a website that basicly had a small tutorial for integrating your wordpress blog posts into your website pages. so that you can keep your website layout/template and not have to have people go to the wordpress blog page to look at the blogs. i was going for a blog that was just posted on my normal website page, and not viewed through the wordpress themed temapltes. so this is what i got with the coding they said to use for displaying the posts on my website, outside of the wordpress blog page. www.jessicadurrant.com/blog.php and as you can see it keep my website layout and menu etc. but it also added the blog header, banner, menu, and the white background in the middle. So im getting on the right track i just need to figure out how to code it or get it so that i dont have to include all the blog stuff i dont want displayed on my page.  the first code they had me put in the head of on my page:

<?php 
/* Short and sweet */
define('WP_USE_THEMES', false);
require('./wordpress/wp-blog-header.php');
?>

<?php define('WP_USE_THEMES', false); get_header(); ?>

 

they said i can call it as false but it still displays the header and etc. which im not sure if it should or if im missing some coding. so i made a thread on the wordpress forum to see if anyone there can help me. But i have not had a reply yet so im hopping that someone here can help me. also here is the php coding they told me to use to display the posts. and this is in the body of my html page.

 

<!-- Start the Loop. -->
					<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
						<?php if ( in_category('1') ) { ?>
           					<div class="post-cat-one">
						<?php } else { ?>
          					<div class="post">
					<?php } ?>
						<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
						<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
						<div class="entry">
   							<?php the_content(); ?>
						</div>
						<p class="postmetadata">Posted in <?php the_category(', '); ?></p>
						</div>
					<!-- Stop The Loop (but note the "else:" - see next line). -->
					<?php endwhile; else: ?>
						<p>Sorry, no posts matched your criteria.</p>
						<?php endif; ?>
                        </div>
                        <!-- REALLY stop The Loop. -->
                        

			 <!-- Start Display The Last 5 Posts -->
                 // Get the last 5 posts.
				<?php
				require('./wordpress/wp-blog-header.php');
				?>
				<?php query_posts('showposts=5'); ?>
				<?php while (have_posts()) : the_post(); ?>
				<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
				<?php endwhile;?>
				<!-- End Display The Last 5 Posts -->

Link to comment
https://forums.phpfreaks.com/topic/237492-help-with-embedding-wordpress/
Share on other sites

Does anyone know how to or know of a tutorial for adding the ability to post a comment on the posts that are displayed on my website using the coding above? so that people can also view the last 5 posts and make a comment to them with out having to go to the wordpress blog main page to make the comments.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.