Last active
August 29, 2015 14:03
-
-
Save awakekat/1ceba3709f38c682d8dc to your computer and use it in GitHub Desktop.
Get WP into HTML sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
At the top of the (.PHP not .HTML) page you want to incorporate WP data: | |
<?php | |
define(‘WP_USE_THEMES’, false); | |
require(‘../wordpress/w-blog-header.php’); | |
?> | |
Where you want it to show up: | |
<!— LOOP START —> | |
<?php | |
global $post; ~this could be page~ | |
$args = array ( ‘category’ => 2, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’); | |
$myposts = get_posts( $args ); | |
foreach( $myposts as $post ) : setup_postdata($post); | |
?> | |
<div class=“newsstory”> | |
<div class=“news header”> | |
<?php the_title(); ?> | |
</div> | |
<div class=“newsdate”> | |
<?php the_date(); ?> | |
</div> | |
<div class=“newscontent”> | |
<?php the_content(); ?> | |
</div> | |
</div> | |
<?php endforeach; ?> | |
<!-- LOOP END --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment